Click here to Skip to main content
16,011,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCView derived class in splitter pane Pin
manonthecorner_19-Nov-04 4:06
manonthecorner_19-Nov-04 4:06 
GeneralRe: CView derived class in splitter pane Pin
BlackDice19-Nov-04 4:34
BlackDice19-Nov-04 4:34 
GeneralRe: CView derived class in splitter pane Pin
manonthecorner_19-Nov-04 5:15
manonthecorner_19-Nov-04 5:15 
GeneralSaving data and version handling Pin
Cedric Moonen19-Nov-04 3:55
Cedric Moonen19-Nov-04 3:55 
GeneralRe: Saving data and version handling Pin
Navin19-Nov-04 5:29
Navin19-Nov-04 5:29 
GeneralRe: Saving data and version handling Pin
Cedric Moonen19-Nov-04 6:34
Cedric Moonen19-Nov-04 6:34 
GeneralRe: Saving data and version handling Pin
Blake Miller19-Nov-04 5:30
Blake Miller19-Nov-04 5:30 
GeneralRe: Saving data and version handling Pin
Henry miller19-Nov-04 6:21
Henry miller19-Nov-04 6:21 
I've seen many ways to do this, not all are compatable. Some that I've seen:

Best: don't write out structs. Write XML or some other text format that is [partially] human readable.


Each struct starts with two fields, majic and version. magic is a number (often someone's birthday), choosen so that no two structers magics will ever be reused. Math people sometimes statisticly find some bit pattern that is unlikley to be hit randomly, so they can detect file corruption and the like.

#define MYSTRUCT_MAGIC 0x19540331 // mom's birthday
struct mystuct {
LONG magic;
LONG verion;
... // all data
}

When loading you check magic and version. If they are recognized you load, if the version is old you may reorginize things, and such.


It is a good idea to start your files with a simple string that says what recorded it.

save(struct myDataList *data) {
fd = open(...);
write(fd,"myApp Version 1.x",16);
... // write all the structs out here
}


I don't really like your idea. It doesn't deal with the case where you delete a member, or change the meaning of a member.
GeneralRe: Saving data and version handling Pin
Cedric Moonen19-Nov-04 6:37
Cedric Moonen19-Nov-04 6:37 
GeneralRe: Saving data and version handling Pin
Henry miller19-Nov-04 7:56
Henry miller19-Nov-04 7:56 
GeneralRe: Thanks ! Pin
Cedric Moonen19-Nov-04 6:39
Cedric Moonen19-Nov-04 6:39 
QuestionUCHAR to string??? how? Pin
blueworks19-Nov-04 3:43
blueworks19-Nov-04 3:43 
AnswerRe: UCHAR to string??? how? Pin
BlackDice19-Nov-04 4:02
BlackDice19-Nov-04 4:02 
GeneralRe: UCHAR to string??? how? Pin
blueworks19-Nov-04 4:10
blueworks19-Nov-04 4:10 
Generalcan't seem to make FindWindow() work right Pin
BlackDice19-Nov-04 3:12
BlackDice19-Nov-04 3:12 
GeneralRe: can't seem to make FindWindow() work right Pin
David Crow19-Nov-04 3:34
David Crow19-Nov-04 3:34 
GeneralRe: can't seem to make FindWindow() work right Pin
BlackDice19-Nov-04 3:53
BlackDice19-Nov-04 3:53 
GeneralResolved Pin
BlackDice19-Nov-04 4:19
BlackDice19-Nov-04 4:19 
GeneralActive Directory (Microsoft LDAP SDK) : Problem with ldap_bind_s Pin
Devendra Chandola19-Nov-04 2:28
Devendra Chandola19-Nov-04 2:28 
GeneralODBC And MS SQL Pin
GermanGeorge19-Nov-04 2:14
GermanGeorge19-Nov-04 2:14 
GeneralTesting tool needed Pin
Cohen19-Nov-04 2:05
Cohen19-Nov-04 2:05 
GeneralCWinThread Pin
shijuck19-Nov-04 1:41
shijuck19-Nov-04 1:41 
GeneralRe: CWinThread Pin
Chris Meech19-Nov-04 2:43
Chris Meech19-Nov-04 2:43 
GeneralVC6 and up-to-date Platform SDK Pin
peterchen19-Nov-04 1:30
peterchen19-Nov-04 1:30 
GeneralRe: VC6 and up-to-date Platform SDK Pin
Jim Crafton19-Nov-04 4:23
Jim Crafton19-Nov-04 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.