Hello list readers,

I am having some confusion about how pipes work in Linux
when being read/written with fread/fwrite.  I am getting some
random data error and suspect it may be how pipes work.

Several programs are piping data between job steps.  It seems
to me if I use either:

fwrite(bufptr, size=1, count=100, fp) or
fwrite(bufptr, size=100, count=1, fp that 100 bytes will be
written to the pipe before the system returns from the fwrite
call.  There is never a partial write to the pipe.
Right?

If I use fread(bufptr, size=1, count=100, fp), the system MAY
return a count of less that 100 bytes and not give an error
indication via ferror(fp).  Right?

But if I use fread(bufptr, size=100, count=1, fp) that the system
will ONLY return when 100 bytes have been read and never give
a partial read because the count returned can only be 0 or 1.
Right?

The programs involved do not test for short reads and have a mixture
of both forms of fread calls.  I think I can solve my problem if I
make sure all reads use a count of 1 and a size of the buffer I want
to read.  Right?

Thanks in advance,

Jim Bevier
[EMAIL PROTECTED]


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to