Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: c accept redirect file
10-14-2012, 12:06 AM #1
c accept redirect file
I am making a test program that is redirected a text file and the program
is required to store and display the redirected input in an string.
mycprogram < mytextfile.txt
I've been trying to treat the redirect as a stdin input, so something like:
fscanf(stdin, "%s", rinput);
fprintf(stdout, "%s\n", rinput);
of the expected output.
Any help is appreciated.
Thanks ahead of time.
10-20-2012, 11:07 PM #2
Let me rephrase the problem.
The program works under ssh, and linux, but doesn't give desirable output
Is there a way to redirect a file to program in MinGW?
./program < filea.txt
output: A, B, C, D