Jump to content
  • Advertisement

Archived

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

WizHarDx

damn fstream

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

Hi I am making the level editor for my game, its working fine but when I save & then load it does not work correctly. In the structure I am saving it has 3 HBITMAPS & 2 Arrays. I am guessing the problem is that the struct contains pointers so it is saving the memory address not the data or something like that , anyways do any of you know how to overcome this problem. thanx in advance WizHarD

Share this post


Link to post
Share on other sites
Advertisement
be sure when saving to a file to save the objects, like you said, not the pointers. For example.

  
int* data = MyDataLoader();
//BAD

MyWriteFunction(data);
//GOOD

MyWriteFunction(*data);


You could always write each member of the structure, or make it into a class with a save function. Since I tend to lean towards classes anyway, the second is what I would do.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"

Share this post


Link to post
Share on other sites
You cannot save the HBITMAPs directly because they are handles. You must get the bitmap header data (dimensions, bits-per-pixel, etc.) and save it into a file yourself. If you do not need a custom format then you should use the Windows bitmap file format (BMP). Wotsit.org should have information about this.

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!