The best way to parse a file...

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

  1. JohnVil

    JohnVil New Member

    Joined:
    Oct 2, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

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

    0003...0002..0004....

    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice