Jump to content
  • Advertisement
Sign in to follow this  
TwistedPrune

MFC serialization. Reading in a vector without knowing the size

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

[color=#000000][font=verdana, geneva, lucida,]We serialize a vector by writing out the size and then each element in the usual way. However in a badly written class the number written to some files that should be the size is less than the actual number of elements written from the vector.[/font]

[color=#000000][font=verdana, geneva, lucida,]This error happens rarely however it would be good to be able to recover these corrupt files when they appear. [/font]

[color=#000000][font=verdana, geneva, lucida,]The thing been serialized in the vector is itself a class which has a serialize method which begins:[/font]

[color=#000000][font=verdana, geneva, lucida,]CObject::Serialize(ar);[/font]
[color=#000000][font=verdana, geneva, lucida,]ar.SerializeClass(RUNTIME_CLASS...[/font]

[color=#000000][font=verdana, geneva, lucida,]in the usual way. The next element after the vector is an integer.[/font]

[color=#000000][font=verdana, geneva, lucida,]Is there any way to attempt to serialize a class which may or may not be there and then recover when it doesn't work to proceed in a different way?[/font]

[color=#000000][font=verdana, geneva, lucida,]Thanks for any help.[/font]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!