formatting a floppy in C

This is a discussion on formatting a floppy in C within the C Programming forums, part of the General Programming Boards category; does anyone know how to format a floppy disk in C? i am using a linux machine where the floppy ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 01:55 PM
  2. floppy eraser error catching!
    By mabufo in forum C++ Programming
    Replies: 7
    Last Post: 01-23-2005, 01:06 PM
  3. dos game help
    By kwm32 in forum Game Programming
    Replies: 7
    Last Post: 03-28-2004, 05:28 PM
  4. floppy disk filesystems
    By Leeman_s in forum Tech Board
    Replies: 5
    Last Post: 12-10-2003, 03:54 PM
  5. selecting input from a floppy
    By neilman88 in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2003, 02:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21