Mail Archives: djgpp/1997/12/11/23:01:36
On Wed, 10 Dec 1997, Mark Favata wrote:
> 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?
..
better idea: use stat(2) to determine the file's length (read the Info
docs for details) so you don't have to rely on feof() or similar. Also, if
you know the length in advance, you can fwrite() your buffer to the file
in 8K chunks, which is very fast.
- Raw text -