[comp.sys.mac.programmer] LSC Stdio bug in fwrite

mkg@lzsc.ATT.COM (Marsh Gosnell) (02/18/89)

I found a bug in fwrite that causes it to truncate writes that contain
characters with the high bit set.  The characters affected are mostly
those formed with the option key.  The fwrite will stop after writing
the first such character in the output buffer.

A fix is to change stdfwrite.c from:
	if ... (fputc(fp, *ptr) == *ptr++)
to
	if ... (fputc(fp, *ptr++) >= 0)

If you're wondering, the bug is caused by the comparison of the integer
value returned by fputc against the sign-extended character pointed to by ptr.

  Marsh Gosnell  att!lzma!mkg