1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The best way to parse a file...

Discussion in 'C++' started by JohnVil, Oct 2, 2010.

  1. JohnVil

    JohnVil New Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:

    Im setting up a file which has the length of a buffer in 4 bytes followed by the buffer


    and so on just that the numbers are a lot bigger up to 9999 but thats just an example. I've been using fgets and fseek to first read the 4 bytes do an atoi then get the buffer then the next length but it seems a little unwieldy. Is there a better way? Is it recommended to read the entire file and put it in memory to work off of it there? How could that be accomplished? Thanks for any help.

Share This Page