what does fputs return?
Dave Kennedy
davek at bcs800.UUCP
Wed Nov 21 05:28:17 AEST 1990
I ran into an odd little bug porting the following line of code:
while (fgets(string, SIZE, file1) && fputs(string, file2));
Please note the word PORTING; I didn't write it.
Anyway, while tracking the bug in this line, I found that the
various documentation I have for fputs is rather conflicting.
Following is what I found:
Document fputs return value upon success
------------------------------- -------------------------------
AT&T Sys V Rel 2.0/3.0 Prog Ref Doesn't say - just an int
Digital VAX C RTL Ref Manual Nonnegative number
SVID Issue 2, Volume I Number of characters written
Turbo C Ref Guide Version 2.0 The last character written
Turbo C++ Library Ref The last character written
K&R II, pp. 164-165 0
AIX O/S Technical Ref Number of characters written
SCO Xenix System V Prog Ref Doesn't say - just an int
All return EOF if there is an error.
I could go on, but I'm sure you get the idea. Unfortunately, I don't
have access to the ANSI standard document, so what is the "right"
return value upon success? If the return value is undefined, then all
of the above are correct.
are correct.
--
Dave Kennedy | ...!uunet!gatech!emory!bcs800!davek | If you don't like |
404-431-1254 | Any opinions expressed are all mine | it, don't read it |
More information about the Comp.lang.c
mailing list