🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9628

How it got "broke"...

#9628
From: Chris Sylvain
Date: Tue, 21 Oct 1986 15:59
22 lines
1318 bytes
[]
Why "while( fputc(fgetc(fd), fe) != EOF )" quit working as it
did under both 2.9BSD and Ultrix 1.2 ...
1)  At the end of file, fgetc() returns (int) -1.
2)  fputc() prints (char) -1 and then returns a CHAR not an INT.

Naturally, (int) -1 != (char) -1, so we have a problem.
Question is now: can I deduce that under 2.9BSD and Ultrix
in the above code fragment there is an implied cast, i.e.,
(char) EOF or (int) fputc() ?

[thanks to everyone who responded to the previous posting.]
-- 
--==---==---==--
.. O frabjous day! Callooh! Callay! ..

ARPA: don@umd5.UMD.EDU     BITNET: don%umd5@umd2
UUCP: ..!{ seismo!umcp-cs, ihnp4!rlgvax }!cvl!umd5!don

** WARNING: don@mimsy.UMD.EDU is a different person **
** (umcp-cs and mimsy.umd.edu are the same machine) **
**   -->   Please double-check the address   <--    **
Technical Details
Message-ID: <1322@umd5>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!rutgers!husc6!seismo!umcp-cs!cvl!umd5!don

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!rutgers!husc6!seismo!umcp-cs!cvl!umd5!don
From: don@umd5 (Chris Sylvain)
Newsgroups: net.lang.c
Subject: How it got "broke"...
Message-ID: <1322@umd5>
Date: Tue, 21-Oct-86 11:59:17 EDT
Article-I.D.: umd5.1322
Posted: Tue Oct 21 11:59:17 1986
Date-Received: Wed, 22-Oct-86 06:31:33 EDT
Organization: University of Maryland, College Park
Lines: 22
Keywords: CHAR not an INT