How do I tell if STDIN is a PIPE?
Jeffrey J. Rodriguez
jjr at ace.ece.arizona.edu
Mon May 27 10:23:27 AEST 1991
How do I tell whether stdin is coming from a pipe?
There must be some system call I can use from a C program.
My problem is that lseek & fseek won't work with a pipe.
Therefore, I need to check stdin to see if it is coming from a pipe.
If stdin is coming from a pipe, then what is the best way to do a seek?
If the input data is not ASCII, then a loop of getchar() won't work.
Therefore, it seems like a loop of fread (one byte at a time)
would be required.
Please let me know if there's a better way to handle this.
Jeff
rodriguez at ece.arizona.edu
More information about the Comp.unix.programmer
mailing list