Jump to content
  • Advertisement
Sign in to follow this  
Sephirox

write floppy's track 1 using dev c++

This topic is 4995 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
Advertisement
I believe CreateFile with a file name of "\\.\A:" will allow access to the drive for writing and reading, at least in VC.

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
Your in luck. The API is Identical :)

Just try and run some samples (assuming everything links and compiles correctly).

I use VS.NET primarily but the other app is nice in its own right.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!