Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » How to load only header of the file with LoadFromFile?
Re: How to load only header of the file with LoadFromFile? [message #19745 is a reply to message #19741] Fri, 09 January 2009 19:22 Go to previous messageGo to previous message
White_Owl is currently offline  White_Owl
Messages: 27
Registered: January 2009
Location: New York
Promising Member
luzr wrote on Thu, 08 January 2009 23:05

If you want to use Serialize, you can still dividide it to Header and Data sections
Are you suggesting to divide my data class to header and actual_data classes?
That can work, but I do not like this idea, because for all other purposes one big class would be better than two separate.

luzr wrote on Thu, 08 January 2009 23:05

- you only cannot use LoadFromFile because it adds some magic values around the data.
Well, I generate these files myself so it should not be a problem...
luzr wrote on Thu, 08 January 2009 23:05

But you can call Serialize directly
Something like this?
class MyData {
   void Serialize_Header(Stream &s) {
      s % data_description;
   }
   void Serialize_Data(Stream &s) {
      s % data1 % data2 % data3;
   }
   void Serialize(Stream &s) {
      Serialize_Header(s);
      Serialize_Data(s);
   }
};
.....
FileIn fi(file_name);
MyData d;
d.Serialize_Header(fi);
fi.Close()
But in that case LoadFromFile() wont work at all, since both header and data would have this 'magic values' around them?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: GetUserName fails on WinXP/MinGW
Next Topic: Quick bi-array
Goto Forum:
  


Current Time: Mon Jun 10 17:24:08 CEST 2024

Total time taken to generate the page: 0.01451 seconds