C, When piping in input getchar() doesn't work, what to do? (UNIX)?
C, When piping in input getchar() doesn't work, what to do? (UNIX)? When I execute my program with a pipe input it fails:
echo /avr/prj/blink | ./buildconvupload
the line of code, userOption = getchar();
doesn't work. I used gdb to check why, and it turns out that when I pipe an input in my program getchar() only reads in -1 and loops. But executing my program without a pipe input works fine.
Is it because piping in redirects the input and prevents the user from inputing a character into getchar()? If so how would I make this work?
|