fread()
Joe_W_Wright at cup.portal.com
Joe_W_Wright at cup.portal.com
Thu May 23 07:32:10 AEST 1991
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 at cup.portal.com
More information about the Comp.lang.c
mailing list