simple unix app pleae help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
deus_the_programmer

simple unix app pleae help

Post 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.
rexlunae

RE:simple unix app pleae help

Post by rexlunae »

why can't you just do this with dd?
prabuinet

RE:simple unix app pleae help

Post 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.
deus_the_programmer

RE:simple unix app pleae help

Post by deus_the_programmer »

i am trying to port it to a unix like system without dd
rexlunae

RE:simple unix app pleae help

Post by rexlunae »

Then, if you are looking for source, I recommend looking at the source for the dd program in your favorite *nix.
GT

RE:simple unix app pleae help

Post 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.
Post Reply