-
formatting a floppy in C
does anyone know how to format a floppy disk in C? i am using a linux machine where the floppy is accessed as "/dev/fd0".
each block on the floppy is 512 bytes, and with 80 cyclinders, 2 heads, and 18 sectors per track... so we have 2880 blocks. the first block is block 0, and the last is 2879.
does anyone know how many blocks will be needed to write a formatting utility which initializes the data in these blocks? need to remember that some blocks will be reserved for keeping track of free blocks.
thanks.
-
There's a difference between formatting (as you describe) and writing an initial file system (FAT16 or fs2 or whatever) which the average user can use to store files.
Having said that, try some of the following commands
Code:
man fdformat
man ioctl
man ioctl_list
/usr/include/linux/fd.h
I was expecting there to be an ioctl() to format a floppy, but the one listed is marked as obsolete.
I suppose you could locate and examine the source code for the fdformat command.
-
the kind of formatting i'm interested is the disk initialization variety. anyone have any pointers (no... not C *pointers) on this?