[comp.lang.c] FREAD & FWRITE

dsr@stl.stc.co.uk (11/13/89)

I'm using fread and fwrite to send structures over a socket.  One
thing that bothers me is the use of n in fread(ptr, sizeof(*ptr), n, stream);
and in fwrite.

When I write 1 structure and put n=1, then on my read side say that
I'm reading 1 item the program waits until the process dies.  If
however I say I'm writing n=2 but send only one structure then the
information gets through straight away.  Why is this so?  I use fflush
straight after my write but that has no effect.  Also does n refer to
the number of structures or to the number of fields within a
structure?  What would happen if I just made n a large number?