How to differentiate between pipe and interactive stdin
So far, I have that if the filename argument (fname) is left empty, the
program reads stdin automatically.
if (!strcmp(fname, ""))
fin = stdin;
But I need to know whether that stdin was piped in, or interactive,
because I could possibly get something like:
rsm: reading from (stdin)
^Z
rsm:(stdin):1: not an attribute: `√┘2ç∩'
if interactive input was used. Is there some sort of library function I
could use?
No comments:
Post a Comment