hi i am looking for an ANSI C program to write Zeros to a floppy disk any source code available ?
thanks,
ed.
Printable View
hi i am looking for an ANSI C program to write Zeros to a floppy disk any source code available ?
thanks,
ed.
If that's not what you want, then you need to give more information on what exactly you're trying to do.Code:#include <stdlib.h>
int main(void)
{
system("echo 000000000 > /dev/floppy);
return 0;
}
Quzah.Code:fputc( 0, fp );
hi thanks for your reply, i am trying to write zeros to a floppy disk in DOS.
a 1.44mb disk
thanks, ed.
quzah's suggestion will work just fine then.
Trying to format the diskette, by any chance?
I don't see a bunch of 0s as much of a format...
Well... I mean, what else would you want to write zeroes to a disk for...?
Formatting is setting up the disk for use with a given file system. Zero-filling is to effectively wipe what's been there before. Google 'undelete' if you still need help understanding the why.
Quzah.
ahhh... you're filling the diskette with zero's so as to effectively replace the data that was stored there before???
but doesnt a FULL FORMAT erase everything on a disk?
Who knows what he's doing? He didn't give a lot of information in his question which is why I gave him an equally half-assed answer.
Ya gotta love these people with their vague questions, who when propositioned
for a more specific question, regurgitate their original question with a few words
changed!
I'm assuming the same as quzah, that you want to "wipe" the disk. A full format
is the best way to do this, because if you were to directly write 0 to each sector
on the disk, it would probably have to be formatted to be used again.
If I'm not mistaken, floppy disks use FAT file system (at least under windows -
not sure, but if I'm wrong, someone will undoubtedly correct me). That'll
undoubtedly take a few bytes, regardless of file system. Find out the maximum
size file you can it on the formatted disk, write a program that generates a
text file of that size (filled with 0's if you like), and copy it to the disk!
If you really want to destroy your evidence, I suggest throwing the floppy in a
fire: magnetic tape + heat = no data ;)
That's called degaussing, and writing zeroes to format a disk isn't a very good idea to me. I prefer AES to start with, and something called a shredder to end with. But heck, if the OP isn't talking, we'll do good to leave it at that.
will copying sumthin big like a file which is 1.3megs large work too?? i mean, it may not totally fill up the disk, but at least most of it will be overwritten right? the remaining bits will be unreadable (hopefully)
what've u got in that floppy anyways??
Here's a nice ANSI C program in action:Quote:
Originally Posted by deus
And the source code's even available too!Code:dd if=/dev/zero of=/dev/fd0
/dev/urandom would probably do a better job of scrambling the disk.