Essentially, I'm trying to pipe the output of a text file, lets call it test.txt, into my C program, lets call it program.
I assume I would evoke this by typing "cat test.txt | ./program".
In the actual code, I would handle it like any command line operation ( utilizing argc/argv ). Is this logic correct? I don't have to do any pipe programming do I?
Unfortunately my logic doesn't follow as it's not working. Any advice is appreciated.
here is the code i have written - its pretty simple.
Code:int main( int argc, char * argv[] ) { int i; printf("%d\n", argc); for(i=1; i < argc; i++) { printf("%s",argv[i]); } printf("\n"); return 0; }