Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!equinox!sanjuan!whitbeck From: whitbeck@sanjuan.wrcr.unr.edu (Mike Whitbeck) Newsgroups: comp.lang.c Subject: fflush()? fscanf() fgets() problem. Message-ID: <456@equinox.unr.edu> Date: 31 May 91 06:44:57 GMT Sender: news@equinox.unr.edu Reply-To: whitbeck@sanjuan.UUCP (Mike Whitbeck) Distribution: na Organization: DRI-WRC Reno Lines: 26 I have a problem using fscanf() and fgets() and was wondering if it had something to do with fflush() {I guess I just don't know what fflush() is for!} I open a file fp = fopen("file","r"); and then I read some stuff fscanf(fp,"%f\n",&fv); then later I try to suck in a line as a text string fgets(str,n,fp); Elsewhere I have used fgets() to read in a line but here it fails! (gets only the first 'word' (whitespace delimited) from the line. As a workaround I use a loop for (...) { fscanf(fp,"%s",dummy); strcat(line," "); strcat(line,dummy); } ICK! What's going on here? Is fscanf() known to mess up fgets()? or is this unique to me? [I am using a SUN 3/80]. HELP!