Hl******@gmail.com wrote:
# Is it possible to have one process (program) that
# redirects its stdin to a file, and have a second program
# use that file write/append to that file. The first program
# will then read its redirected standard input file and
# process that...
As a counterexample, it will probably not work the way you expect
on Unix. If you open read a plain disk file, the kernel does not
change the behavior if there are writers - either you get data
that is currently in the file, or you get an EOF. You don't get
paused while other writers catch up. (There are other types of
files that this will work on in Unix, but these types of files
are not available on all other systems.)
Perhaps your stdio will let read past an EOF so you can keep
trying to see if the file has been extended. (The underlying
Unix I/O permits this, allowing commands like tail -f.) But I
think this is system dependent behaviour.
On Unix freopn to stderr is irrelevant to this: it's a property
of the files themselves not the FILE* connected to them.
--
SM Ryan
http://www.rawbw.com/~wyrmwif/
Raining down sulphur is like an endurance trial, man. Genocide is the
most exhausting activity one can engage in. Next to soccer.