Question

I want to write a program that formats a disc to a new format (not NTFS or FAT32) and can read from and write to the disc, In order to do this, I have to have a way to write single bytes to a disc (without creating files). How do I do that?

EDIT: I found this. But I'm not sure if using CreateFile() as Eli Bendersky said in the first answer (when organized in order of votes) let's you write one byte (or even one bit) at a time, or do you have to write full sectors at a time.

Answer: Since I can't post an answer the question because it was closed, I will answer it write here. You don't need need API functions to do this. All you need to do is open the disk like you open any other file. Like this:

int hFile;
hFile=open("/dev/sdb",0_RDWR);
Was it helpful?

Solution

You program has to directly talk to the driver as you will be by-passing the file-system.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top