Page 1 of 1
simple unix app pleae help
Posted: Fri Jun 18, 2004 11:00 pm
by deus_the_programmer
Hi i want to write a simple unix appliation that will wipe every sector on A: (/dev/fd0 in linux).
after which i want to write another separate appliation to copy a disk image file to the floppy.
please help me, either sample source or web site with useful information.
many thanks in advance.
ed.
RE:simple unix app pleae help
Posted: Fri Jun 18, 2004 11:00 pm
by rexlunae
why can't you just do this with dd?
RE:simple unix app pleae help
Posted: Sat Jun 19, 2004 11:00 pm
by prabuinet
to write an image file over a real floppy just give this command
dd if=floppy_image_file_name of=/dev/fd0 bs=512
CAUTION: Everything in the floppy will Go to heaven. so have a backup before trying this.
remember: floppy_image_file_name should be the name of ur image file.
RE:simple unix app pleae help
Posted: Mon Jun 21, 2004 11:00 pm
by deus_the_programmer
i am trying to port it to a unix like system without dd
RE:simple unix app pleae help
Posted: Mon Jun 21, 2004 11:00 pm
by rexlunae
Then, if you are looking for source, I recommend looking at the source for the dd program in your favorite *nix.
RE:simple unix app pleae help
Posted: Mon Jun 21, 2004 11:00 pm
by GT
Type these commands at your Unix shell prompt:
man fopen
man fread
man fwrite
man fclose
These are all the commands you'll need to accomplish the task, and it'll take all of a half dozen real lines of code. Hint: assuming you have the privs (i.e. you're "root", or in the "disk" group on some unices), fopen("/dev/fd0", "w"). It's that simple -- under Unix, a device is just another file, you need no special commands to write to it, use the same you'd use for any other file.