Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!ohstpy!smithj From: SMITHJ@ohstpy.mps.ohio-state.edu Newsgroups: comp.lang.c Subject: fscanf question Message-ID: <6983@ohstpy.mps.ohio-state.edu> Date: 27 Dec 89 22:50:46 GMT Lines: 33 Sorry if this has come up before but I'm puzzled as to why the following code doesn't work. The fprintf works fine but nothing is read in by the fscanf. Thanx in advance. #include int main(void) { FILE *stream; char outstr1[]="Trying", outstr2[]="Hoping"; char instr1[30], instr2[30]; stream = fopen("try2.gbk","w"); fprintf(stream,"%-30s %-30s",outstr1,outstr2); fclose(stream); stream = fopen("try2.gbk","r"); fscanf(stream,"%-30s %-30s",instr1,instr2); fclose(stream); } -- I knew how the game was going to end when I took Brenda into the filing room but I took her in anyway. --Al They have one big advantage over us: *they* know where they're going. --Batman Has your family tried 'em, Powdermilk? --Garrison Keillor /* Jeffery G. Smith, BS-RHIT (AKA Doc. Insomnia, WMHD-FM) * * The Ohio State University, Graduate Physics Program * * 3193 Smith Lab, Columbus, OH 43210 (614) 292-5321 * * smithj@ohstpy.mps.ohio-state.edu */