Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!cmdnfs!bhoughto From: bhoughto@cmdnfs.intel.com (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: fgets Keywords: tc, tc++ Message-ID: <576@inews.intel.com> Date: 23 Oct 90 16:07:03 GMT References: <52039@unix.cis.pitt.edu> Sender: news@inews.intel.com Distribution: na Organization: Intel Corp, Chandler, AZ Lines: 33 In article <52039@unix.cis.pitt.edu> ydist@unix.cis.pitt.edu (Yijun Ding) writes: >After many tries to recompile my word processor by TC++, I find >the following difference: > >fputs("", fp) return 0 in TC 2.0 > return (-1) in TC++ > >Which is correct ? Under ANSI, the return value on error from fputs() is an EOF, the return value if no error is "nonnegative". In older versions (e.g.: on Apollos; and on Ultrix boxes, which prove that "older" is not necessarily noncontemporaneous with "current" :) there doesn't seem to be any mention of fputs(3)'s having a return value. It seems logical that fputs() might have returned 0 on failure and nonzero on success, such that `if ( fputs(...) )' might work. In your case, the WP seems to depend on the "older" return value. Go through and see if you can find where they've assigned or compared the return value of fputs() with anything. try egrep '=.*fputs|fputs.*=' *.[ch] in the source directory. --Blair "...somma that old-time a-rock and roll..." -some Seeger