I have this set of .gz files and inside each of them is a single text file. This text file needs to be used in a C program. The following code solves this problem somehow where parameters 1 and 2 are integers which I'm receiving as arguments for the C program (argc, argv[]) in main()
.
gzip -dc xyz.txt.gz | ./program parameter1 parameter2
Can someone explain how the above code works in command line? How does the text file automatically get passed to the program? Do I need to write extra code in the C program to receive this text file?
The shell connects the stdout of one command directly to the stdin of the other command through a pipe(7). Neither program has to do anything out of the ordinary to take advantage of this.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments