[Next][Index]
fscanf return value in pC++
- Date: Fri, 23 Dec 94 22:32:40 -0500
- From: "Vladimir Menkov" <vmenkov>
- To: sage-bugs@cica.indiana.edu
- Subject: fscanf return value in pC++
Hello,
I noticed that fscanf does not return the expected return value
in pC++. I compiled the attached program on kilimanjaro and on
caledonia, in both cases the return value (d) contains garbage,
rather than 1.
The program:
------------------------------------------------
#include "pcxx.h"
void Processor_Main() {
int n, d;
char s[128];
FILE * f = fopen("foo", "r");
if (!f) return;
d = fscanf(f, "%s", s);
printf("s=%s, d=%d\n", s,d);
d = fscanf(f, "%d", &n);
printf("n=%d, d=%d\n", n,d);
}
------------------------------------------------
The data file ("foo", 2 lines):
------------------------------------------------
test
234
------------------------------------------------
Regards,
--Vladimir