in reply to how do i format a hard drive

Run the appropriate command for your operating system with system. Check for errors -- particularly if your OS requires you to have certain permissions to format your disk.

It's easiest if you run your formatting program in some non-interactive mode (you don't want to have to read an "<samp>Are you sure? (Y/N)</samp>" line and have to answer it).

Originally posted as a Categorized Answer.