Sign in to follow this  

write floppy's track 1 using dev c++

This topic is 4780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, im trying to write to the first track of a floppy...ive seen examples using djgpp, but id like to do it using dev c++...basically, i need to write 512 bytes to the first track of a floppy (so i can boot from it), thx in advance

Share this post


Link to post
Share on other sites
yes, but, will it be on the first sector of the first track? i need to make sure my 512 byte program is in the first 512 bytes of the disk ( i need to write to the disk starting at offset 0)

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp

The msdn link to that function. As far as I can tell (in past experience also) is that it opens up the actual physical drive for reading/writing. Which should give you the very first area of the disk.

I believe this is the lowest level you can get with Windows, but could be wrong. You should just try and see :)

Share this post


Link to post
Share on other sites
Here's a document detailing the FAT12 file system which is what floppy disks uses. You don't need to read the whole document - the structure of the first 512 bytes (the bootsector) is listed fairly early on so you can skip the rest: clicky (the document covers all FAT filesystems - 12/16 and 32).

To access the floppy disk as a file you can open it like so:
FILE *FilePtr = fopen("\\\\.\\a:", "wb");

Share this post


Link to post
Share on other sites

This topic is 4780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this