Jump to content
  • Advertisement

Archived

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

mond

fstream for reading binary files

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

Simple question : are file streams really the best way to read in binary data from a file? Let''s say, for example, that I have a level map I want to read in. I need to parse out the first few bytes/words of the file for some information. Since the IOStreams are based on character types, this doesn''t seem to be an intuitive way to read this type of data in. So what are you all using to read binary files that many times need to be read on some sort of byte offset? fstreams? C Standard Library functions? Something else?

Share this post


Link to post
Share on other sites
Advertisement
I use fread/fwrite for binary stuff. The iostreams are nice for ascii but in my opinion (and in the opinion of many others) they are too cumbersome and messy for binary use.



Share this post


Link to post
Share on other sites
iostreams work fine, as do stdio functions. There are no one best way to do anything.

EDIT1: to -> do



Update GameDev.net system time campaign - success at last

[edited by - dalleboy on March 30, 2003 2:50:31 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!