Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!mips!apple!portal!cup.portal.com!Joe_W_Wright From: Joe_W_Wright@cup.portal.com Newsgroups: comp.lang.c Subject: fread() Message-ID: <42589@cup.portal.com> Date: 22 May 91 21:32:10 GMT Organization: The Portal System (TM) Lines: 36 I have a K&R C compiler and would write, as functions, the fread() and fwrite() routines which don't exist in old C. [We have only getc(fp) and putc(c,fp).] As I understand them, the prototype calls would be: fread(&memory, sizeof(object), num_of_objects, fp); and the function might be: int fread(buf,size,num,fp) char *buf; int size,num; FILE *fp; { } Questions: 1. What is the 'normal' successful return from fread()? 2. What if either size or num is 0? 3. What if EOF is encountered before num objects are read? 4. What if EOF is encountered within an object. int fwrite(buf,size,num,fp) char *buf; int size,num; FILE *fp; { } 5. What is the successful return from fwrite()? 6. What is the 'failure' return? (disk full or whatever) 7. As I don't have the 'book' on the subject, what should I be reading so that I don't have to ask these simple questions on the net anymore? Thanks to any and all. Joe_Wright@cup.portal.com