Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!portal!cup.portal.com!morris-ng From: morris-ng@cup.portal.com (Yuklung Morris Ng) Newsgroups: comp.sys.amiga Subject: Re: C scanf question Message-ID: <20578@cup.portal.com> Date: 18 Jul 89 21:18:26 GMT References: <19915@louie.udel.EDU> Distribution: na Organization: The Portal System (TM) Lines: 15 RE: scanf() question: It seems to me that the fprintf() is the problem. When you try to print a string to the file and you write "fprintf(file,"%s",line[80]);" what you are writing is garbage. The program will try to write the string at address &line + 80 and end with a \0 char. So the correct format should be "fprintf(file,"%s",&line);"... +---------+----------------------------+----------------------------------+ | ///| Morris Y. L. Ng | Usenet: morris-ng@cup.portal.com | | /// | Computer Science & Finance | Portal: Yuklung Morris Ng | | /// | San Jose State University | Home : (###)###-#### (Guess?!) | |\\\/// +----------------------------+----------------------------------+ | \XX/ | "Be my Amiga! And I will be your Amigo!" | +---------+---------------------------------------------------------------+