Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!ukc!stl!dsr From: dsr@stl.stc.co.uk Newsgroups: comp.lang.c Subject: FREAD & FWRITE Message-ID: <2402@stl.stc.co.uk> Date: 13 Nov 89 11:17:44 GMT Sender: news@stl.stc.co.uk Reply-To: dsr@stl.stc.co.uk () Organization: STC Technology Limited, London Road, Harlow, Essex, UK Lines: 11 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?