[7479] in Athena Bugs

home help back first fref pref prev next nref lref last post

decmips 7.2R: putc, fputc

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Sun Apr 28 17:28:29 1991

Date: Sun, 28 Apr 91 17:28:13 EDT
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@ATHENA.MIT.EDU

System name:		hodge
Type and version:	KN01 7.2R
Display type:		PM-MONO

What were you trying to do?
	Use the putc and fputc library routines to write the char 0xff
	to a file.

What's wrong:
	Fputc and putc both return -1 (i.e. (int) (char) 0xff, if the
	default char type is signed) rather than returning 255.
	Unfortunately -1 is EOF, which is what the functions are
	supposed to return when they are trying to signal an error,
	which means they signal an error when there is none.

What should have happened:
	The argument to fputc and putc should be converted to unsigned
	char before it is sent to the file or returned.  This is what
	the ANSI C standard says should happen, and this is what in
	fact should happen if this problem is to be avoided.

	If this is not fixed in Ultrix 4.0, it should be sent back to
	DEC.

  jik

home help back first fref pref prev next nref lref last post