[lug] named pipe missunderstanding
Lori Reed
lorireed at lightning-rose.com
Wed Feb 2 09:47:28 MST 2011
On 02/02/2011 09:12 AM, Jason Davis wrote:
> Thanks for the replies. Im pretty sure I can treat named pipes like
> any other file.
Yes, popen(3) returns a pointer to type FILE (as does fopen(3)) , so you
can use any of the FILE stream functions with pipes (ie: fgets(3),
fputs(3), etc).
But you *cannot* rely on files to behave as pipes. You might get away
with it, but you can't rely on it.
Unless the FILE stream is opened with popen(3), then it's *not* a pipe.
> Someone suggested that
> when a process closes the fifo that any data not cunsumed yet will be
> lost. This would explain what Im seeing,
Maybe, but it doesn't matter as using files as pipes is the wrong
approach. If there are no true IPC pipes classes in Java, then you need
to use something else for IPC. Shared memory and sockets are two
possibilities.
Lori
More information about the LUG
mailing list