From: Bjorn De Meyer Newsgroups: comp.os.msdos.djgpp Subject: Re: why is output different each time (2nd try) Date: Tue, 3 Nov 1998 17:19:28 +0100 Organization: University of Ghent, Belgium Lines: 41 Message-ID: References: <01be06eb$47b9e940$5640ab95 AT JUry DOT law DOT unsw DOT edu DOT au> <363F08C7 DOT 6853F8B5 AT montana DOT com> NNTP-Posting-Host: eduserv2.rug.ac.be Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <363F08C7.6853F8B5@montana.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 3 Nov 1998, bowman wrote: > > > Joe Ury wrote: > > > > Sorry my first message had a error in the code. > > Why do I get differing output each time. Its reading a marked up text file > > and the first time it works ok then the next time what looks like memory > > dump is added at the beginning of each line then the next time more of the > > same and after a while its ok again - should I be flushing memory > > somewhere? > > I haven't had time to look at the code deeply, but I do not see the > files being closed anyplace. I would try that first, rather than > depending on exit code to clean up after you. > > Also, you're opening your files in text mode rather than in binary mode, and get you use fgetc. fuse fopen("foo.bar","rb") to open for reading in binary mode. Bjorn De Meyer. IA #i^4 Homepage: http://studwww.rug.ac.be/~bgdmeyer E-mail: bjorn DOT demeyer AT rug DOT ac DOT be Licentiate Chemistry. Coordinator of the "Tales of Artah: First Sword" CRPG project. "I've shaven. I'm happy. I have no religion. Don't pray for me." Illusion of Gaia 2