I work in C,C++ Windows platform. I am to write code to format a pendrive. I searched and found DeviceIOControl() that seemed to fulfill my purpose. But I cannot proceed any further. Plz help me in this regard.

thanx
Shayantani

Did you try this shell API SHFormatDrive . It is the simplest one.
There is not other documented API apart from SHFormatDrive(). Only drawback is it is interactive.
If you do not want user to interact and you are targetting Wk3 you can use WMI classes
see this. You can find a C++ example as well there.
Thanks,
Prateek

Firstly Thanx
I have seen that API. But I have been told not to use that and do the entire coding by myself. I used CreateFile() and have got the disk handle. But I frnkly cannot make out what to do with the handle now.PLz do suggest some alternatives...

Formatting a drive is not a small task if you do not want to use WMI and shell APIs.
You will have to understand the basics of NTFS or FAT(which ever you select).
There are tons of resources on Internet. However, is is not an atomic task...

http://www.ntfs.com/ntfs.htm
http://en.wikipedia.org/wiki/NTFS
http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/core/fncc_fil_khzt.mspx?mfr=true
http://technet2.microsoft.com/windowsserver/en/library/81cc8a8a-bd32-4786-a849-03245d68d8e41033.mspx?mfr=true

I don't know any simple way to format easisly. As I have told you earlier there are no as such documented APIs which can do formetting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.