mmessuri
asked on
C Source code to format a hard drive
I am working on a drive utility and I need a little jumpstart with the formatting routines {having a major brain cramp on the hard drive routines}. What would be of the greatest help would be some source code in C on how to format a hard drive (by the way I am writting this utility for a Intel DOS/16-bit platform, supporting FAT12/FAT16 and eventually FAT32) . I am already able to format a floppy drive and would now like to add hard drive capabilities to the program.
Thanks.
Michael
Thanks.
Michael
ASKER
Thanks for the FYI; However, I am sorry to say that this app will (for now) be running only in a DOS 6.x environment.
-- Michael --
-- Michael --
#include <stdlib.h>
system("format c:");
There's no other way in C. If you want to go to a lower level, you'll have to use platform-specific libraries and extensions, as C itself knows nothing of such things as "drives", contenting itself with the knowledge that there's probably some kind of file system.
Formatting a hard drive is, in any case, such a complex business nowadays that you are well advised not to do this. I can think of exactly one use for the program you propose - malice.
system("format c:");
There's no other way in C. If you want to go to a lower level, you'll have to use platform-specific libraries and extensions, as C itself knows nothing of such things as "drives", contenting itself with the knowledge that there's probably some kind of file system.
Formatting a hard drive is, in any case, such a complex business nowadays that you are well advised not to do this. I can think of exactly one use for the program you propose - malice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
feenix:
Thanks for the answer. While it was not exactly what I was looking for, it does provide enough information for me to move on past my brain block. Besides, the multiple file system information will be helpful as I complete my disk partitioning program (it combines the fdisk program with the format program).
-- Michael --
Thanks for the answer. While it was not exactly what I was looking for, it does provide enough information for me to move on past my brain block. Besides, the multiple file system information will be helpful as I complete my disk partitioning program (it combines the fdisk program with the format program).
-- Michael --
ASKER
C Dreamer:
Thanks for taking the time to comment; however, I was not able to put to use your suggestion as format.com is not going to be available.
BTW:
My intentions are not of malice. The program is a hard disk partitioning application that allows for the creation / deletion and formating of the partition without the use of format.com or fdisk.exe
-- Michael --
Thanks for taking the time to comment; however, I was not able to put to use your suggestion as format.com is not going to be available.
BTW:
My intentions are not of malice. The program is a hard disk partitioning application that allows for the creation / deletion and formating of the partition without the use of format.com or fdisk.exe
-- Michael --
HOWTO: Call SHFormatDrive in Windows 95 and Windows NT
http://support.microsoft.com/support/kb/articles/Q173/6/88.ASP
DeviceIoContol()