Skip to main content
gamedev.net
🔒 Locked

Reading Multiple Resources

Started by jmac7142 0 replies 250+ views
Original Post
jmac7142
jmac7142
Hello, I'm trying to read data from a binary file with multiple resources that each have their own header, containing the distance to the next resource header as well as a uInt32 that needs to be read. My question is this: is it possible to read data from each resource header, keeping in mind that since this is a file type in general, and the distance to the next resource will be different for each file or resource that the user opens, as well as having an unknown amount of resources. Thanks in advance.
jmac7142
jmac7142
I recently read an article on a similar topic and now have the data in a struct. However, I still lack a way to read to the end of the file (an unknown amount of resources), while using a variable that is set from the previous struct that was read. For instance, if the first struct is read as x bytes, how do I implement the reader so that the next resource is x bytes forward in the stream, and so on; with the current resource being read providing the offset for the next resource?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.