Jump to content
  • Advertisement

Archived

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

Ranthalion

Loading/Reading a custom resource

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

I know about LoadResource, LockResource, and FreeResource. I have made a custom resource which is just a text file. What I would like to know is how to load the data into an array of strings, or an array or character arrays. I know how to do this with a file, but how do I do this with a resource? My resource is a text file that has strings seperated by a newline. I''m using MSVC++ 6.0 and Win32.

Share this post


Link to post
Share on other sites
Advertisement
Once you have the resource properly loaded, you should have a void pointer to the beginning of the resource data. So you can probably just cast that pointer to a char pointer and split the new lines manually. Or possibly dump it in a stringstream and extract the lines via getline().

Share this post


Link to post
Share on other sites
that''s what I don''t know how to do. How do I traverse the data to find the newlines?
I have

ptext = (char *)LockResource(hResource);

while (ptext!=''\n'')
{
//How do I go through and determine where to break it off?

}


I don''t know how to move my pointer forward to check if it is the newline yet.

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!