Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!edsews!uunet!unh!jeff From: jeff@unh.UUCP (Jeffrey E. F. Friedl) Newsgroups: comp.lang.c Subject: fwrite man page "error" Keywords: Oh, to be young again. Message-ID: <939@unh.UUCP> Date: 22 Feb 89 05:55:21 GMT Organization: University of New Hampshire, Durham, NH Lines: 37 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).