Punto has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl $fsize = -s $ARGV[0]; open (COR, ">>$ARGV[0]"); for (0..$fsize / 100) { seek(COR, rand($fsize), 0); print COR chr(rand(256)); }; close(COR);
I want it to seek to a random point on the file, and write a random byte there.. But it's writing all the random bytes at the end of the file, and not in the middle of it..
Am I using the wrong function to seek or write to the file?
Thanks..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: corruption.
by jsegal (Friar) on Feb 15, 2002 at 19:03 UTC | |
|
Re: corruption.
by Rich36 (Chaplain) on Feb 15, 2002 at 18:59 UTC |