fwrite man page "error"
Jeffrey E. F. Friedl
jeff at unh.UUCP
Wed Feb 22 15:55:21 AEST 1989
Here's a cute one.
I had a user come to me asking about fread/fwrite,
showing me the man page:
standard fread() man page "SYNTAX" section:
fread(ptr, sizeof(*ptr), nitems, stream)
char *ptr; unsigned nitems, sizeof(*ptr)
FILE *stream;
Pointing to "sizeof(*ptr)" then to "char *ptr", he asked
"but won't that always be one?"
I never noticed the "error" -- sort of cute, eh?
I can just imagine a novice user sitting with the man page
and pounding at the program wondering why it doesn't work!
I offered that the following might be better:
---------------vvvvvvv
fread((char*)ptr, sizeof(*ptr), nitems, stream)
item *ptr; unsigned nitems, sizeof(*ptr)
---------^^^^
FILE *stream;
which seems to make things more clear. I left it at that.
I suppose I should tell him that sizeof(char) is !always 1, though.
*jeff*
------------------------------------------------------------------------------
Jeffrey Eric Francis Friedl Box 2173 Babcock House
..!{uunet,decvax}!unh!jeff Durham New Hampshire 03824
Ever worked in Japan? Let me know your "what-to-do, what-never-to-do" stories.
I'm moving there in May (or so -- whenver the Visa comes through).
More information about the Comp.lang.c
mailing list