ang@latcs1.lat.oz.au (Ang Cheng Chai) (06/07/91)
Hi there, I think this is a bug in MSC 6.00A. Program reads in data from file "inp.dat". Each fscanf should read in the bits of data until it hits a comma. The file ptr does not seem to be advancing. I have included the input as well as the output. This works fine with Turco C++ and MSC 5.1 but not MSC 6.00A. I dont think I'm doing anything wrong. /*--- The program */ #include <stdio.h> #include <stdlib.h> main(int ac, char *av[]) { FILE *fp = (FILE *) NULL; int ns = 0; char tmps[BUFSIZ], tmpc; if ((fp = fopen(av[1], "rt")) == (FILE *) NULL) abort(); for (;;) { ns = fscanf(fp, "%[^,]%c", tmps, &tmpc); printf("Seen(%s)(%d)\n", tmps, ns); } } *---- inp.dat Simple Super,,S,0,SS,10 Simple Super Plus,,P,0,RUNSSP,11 *--- This is the output Seen(Simple Super)(2) Seen(Simple Super)(0) Seen(Simple Super)(0) Seen(Simple Super)(0) Seen(Simple Super)(0) Seen(Simple Super)(0) Seen(Simple Super)(0) Many thanks in advance, Chai. -- ACSnet: ang@latcs1.oz ARPA: ang%latcs1.oz@uunet.uu.net UUCP : {hplabs,mcvax,ukc,nttlab}!uunet!munnari!latcs1.oz!ang
phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (06/11/91)
ang@latcs1.lat.oz.au (Ang Cheng Chai) writes: >This works fine with Turco C++ and MSC 5.1 but not MSC 6.00A. I wonder if it is safe to mix the library from one version with the compiler of another, within the same vendor's compiler line. -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! / \***************************************************************************/