Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

djsteffey

file input/output

This topic is 6506 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

can i open an output file stream (in binary) and just change individual bytes in the file for eaxmple: say i want to open a file in binary, but i only want to modify the first 2 bytes of the file then save the file with the first two bytes changed. Can i do this or would i have to read in the entire file, change first two bytes and then save entire file ? "Now go away or I shall taunt you a second time" - Monty Python and the Holy Grail themGames Productions

Share this post


Link to post
Share on other sites
Advertisement
you can use fseek to seek to the part of the binary file you want to read and then fwrite over it, or fread to read it into memory (of course, this is in borland c)

Share this post


Link to post
Share on other sites
Depending on OS, it''s also possible to just map the file to memory and then twiddle the bits. Of course in Windows File mapping is suppose to be just used for IPC, but it may be more convienient to use it for just file editing.

Share this post


Link to post
Share on other sites

  • 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!