From: Mark Favata Newsgroups: comp.os.msdos.djgpp Subject: Error Writing to File Date: Wed, 10 Dec 1997 15:29:12 -0500 Organization: Scorpion Industries Lines: 24 Message-ID: <348EFB98.25F8@epix.net> NNTP-Posting-Host: svcr-84ppp163.epix.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Can someone please help me. I am writing an encryption program and want to add a file wipe feature. I plan on overwriting the file with 1, then 2, etc. The problem is, it keeps writing past the eof mark. Within about 2 seconds it has already written 2 megs to the file. My code doesn't seem to stop for the EOF. Can you tell me what is wrong with my code? This is like the code I am using: if((in = fopen(argv[1], "rb+")) == NULL) { printf("Error opening output file.\n"); exit(-1); } while(!feof(in)) { fprintf(in, "0"); } fclose(in); Mark Favata favata AT epix DOT net