Home » U++ Library support » U++ Core » How to load only header of the file with LoadFromFile?
How to load only header of the file with LoadFromFile? [message #19740] |
Thu, 08 January 2009 20:22 |
White_Owl
Messages: 27 Registered: January 2009 Location: New York
|
Promising Member |
|
|
I have a pretty big data file with a lot of data.
I need to show list of my data files. So I'd like to read only headers of my data file and ignore actual data.
Right now I see two ways:
1) Modify all LoadFrom*() functions, to add the third parameter bool header=false. And add to Stream function IsHeader();
That would be pretty universal, but a lot of work.
2) Solution "for right now":class MyData {
public:
bool header_only;
String data_description;
void Serialize(Stream &s) {
s % data_description;
if(s.IsLoading() && header_only) return;
s % data1 % data2 % data3 ;
}
};
.....
MyData d;
d.header_only = true;
LoadFromFile(d, file_name);
Is there a third more elegant way?
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 02:03:34 CET 2024
Total time taken to generate the page: 0.02016 seconds
|