Article View: comp.sys.amiga.tech
Article #14154Another Manx 5.0 bug (scanf)
From: Dan Barrett
Date: Sat, 10 Mar 1990 01:04
Date: Sat, 10 Mar 1990 01:04
40 lines
1554 bytes
1554 bytes
scanf() and sscanf() do not work properly with Manx C 5.0a.
I have not tested fscanf().
The problems are:
(1) The functions do not return the correct value on bad inpu.
(2) scanf() does not see EOF until you send it TWICE.
Test program:
#include <stdio.h>
main()
{
int i, result;
result = scanf("%d", &i);
printf("%d %d\n", result, i);
}
Compile: cc t.c
Link: ln t.o -lc
Run: t
Give the input 'z' and scanf incorrectly returns 1, instead of 0. Type
EOF (^\) and scanf ignores it. Type a second ^\ and scanf() sees it.
How the HELL did a big error like this one get out?????????!?!?!?!
Or am I doing something TOTALLY stupid???
I have submitted a bug report to Manx.
Dan
//////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
| Dan Barrett, Department of Computer Science Johns Hopkins University |
| INTERNET: barrett@cs.jhu.edu | |
| COMPUSERVE: >internet:barrett@cs.jhu.edu | UUCP: barrett@jhunix.UUCP |
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////
Technical Details
Message-ID:
<4455@jhunix.HCF.JHU.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!aplcen!jhunix!barrettShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!aplcen!jhunix!barrett From: barrett@jhunix.HCF.JHU.EDU (Dan Barrett) Newsgroups: comp.sys.amiga.tech Subject: Another Manx 5.0 bug (scanf) Message-ID: <4455@jhunix.HCF.JHU.EDU> Date: 10 Mar 90 01:04:20 GMT Organization: The Johns Hopkins University - HCF Lines: 40