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.
simple unix app pleae help
RE:simple unix app pleae help
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.
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
i am trying to port it to a unix like system without dd
RE:simple unix app pleae help
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
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.
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.