Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!njin!princeton!udel!wuarchive!emory!wa4mei!bcs800!davek From: davek@bcs800.UUCP (Dave Kennedy) Newsgroups: comp.lang.c Subject: what does fputs return? Summary: trying to resolve documentation conflicts about what fputs returns Keywords: fputs ANSI Message-ID: <1123@bcs800.UUCP> Date: 20 Nov 90 18:28:17 GMT Distribution: usa Organization: Brock Control Systems, Atlanta, Georgia Lines: 31 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 |