Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!news.nd.edu!news.cs.indiana.edu!arizona.edu!uazhe0.physics.arizona.edu!zazula From: zazula@uazhe0.physics.arizona.edu (RALPH ZAZULA) Newsgroups: comp.sys.next Subject: C prog. *problem* (HHHHEEEEEEEEEEELLLPPP MMMMMEEEEEEE!!!!) Message-ID: <1991Apr12.121245.518@arizona.edu> Date: 12 Apr 91 17:05:22 GMT Reply-To: zazula@uazhe0.physics.arizona.edu Distribution: world,local Organization: U of Arizona Experimental Elementary Particle Physics - Tucson, Lines: 55 Nntp-Posting-Host: uazhe0.physics.arizona.edu News-Software: VAX/VMS VNEWS 1.3-4 Lines: 54 Arg!! I'm pulling my hair out!!!! I have this code that *was* working but now, all of the sudden, it has stopped working. It is so trivial, I can't see what other coding I could have done that would cause it to fail. Here is a fragment represeting what I'm trying to do: double d; int i; char str[255]; FILE *infile; /* infile opened */ while (EOF != fscanf(infile,"%1s",str)) switch(str[0]) { case 'I' : fscanf(infile,"%d",&i); printf("i: %d\n",i); fgets(str,255,infile); /* flush the line */ break; case 'D' : fscanf(infile,"%f",&d); printf("d: %f\n",d); fgets(str,255,infile); /* flush the line */ break; default : exit(0); } This code is applied to an input file such as: I 5 D 0.1 The output I get is: I 5 D 0.000000 *W*H*Y*????? It was giving correct output yesterday... How do I go about trying to see where the fscanf is failing? This is the first code to get executed in my program... Please help, I'm going wacko (ha ha, hee hee...) Ralph |----------------------------------------------------------------------| | Ralph Zazula "Computer Addict!" | | University of Arizona --- Department of Physics | | UAZHEP::ZAZULA (DecNet/HEPNet) | | zazula@uazhe0.physics.arizona.edu (Internet) | |----------------------------------------------------------------------| | "You can twist perceptions, reality won't budge." - Neil Peart | |----------------------------------------------------------------------|