Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!udel!new From: new@udel.EDU (Darren New) Newsgroups: comp.sys.amiga Subject: C scanf question Message-ID: <19915@louie.udel.EDU> Date: 17 Jul 89 20:14:07 GMT Sender: usenet@udel.EDU Reply-To: new@udel.EDU (Darren New) Distribution: na Organization: University of Delaware Lines: 22 I'm having a problem using fscanf under Lattice 5.02. I have a file where each line was written with char flag1='0', flag2='+', line[80]; fprintf(file, "%c%c%s\n", flag1, flag2, line[80]); I'm trying to read it back into the same variables one line at a time. I've tried fscanf(file, "%c%c%s\n", &flag1, &flag2, line); fscanf(file, "%c%c%s ", ...); fscanf(file, " %c%c%s", ...); fscanf(file, "\n%c%c%s", ...); All of these work on the first line and give me a '\n' in flag1 and a '0' in flag2 and a '+' in line[0] on the second and subsequent lines. The lattice library manual states that the space character will skip newlines, tabs, and spaces, and therefore the second or third one should be correct. However, it APPEARS as though Lattice is seeing the first %c and saying I'm not going to skip any whitespace. I'm well versed in C but usually have avoided the STDIO routines for various reasons in the past. Can anyone tell me what I'm doing wrong? -- Darren