Thread: formatting a floppy in C

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    2

    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.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    2
    the kind of formatting i'm interested is the disk initialization variety. anyone have any pointers (no... not C *pointers) on this?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting floppy disks with VC ?
    By krissy in forum Windows Programming
    Replies: 0
    Last Post: 01-06-2006, 02:55 PM
  2. floppy eraser error catching!
    By mabufo in forum C++ Programming
    Replies: 7
    Last Post: 01-23-2005, 02:06 PM
  3. dos game help
    By kwm32 in forum Game Programming
    Replies: 7
    Last Post: 03-28-2004, 06:28 PM
  4. floppy disk filesystems
    By Leeman_s in forum Tech Board
    Replies: 5
    Last Post: 12-10-2003, 04:54 PM
  5. selecting input from a floppy
    By neilman88 in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2003, 02:26 PM