Click here to Skip to main content
15,922,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ Express receiving a custom message Pin
Mark Salsbery23-Jul-11 21:07
Mark Salsbery23-Jul-11 21:07 
GeneralRe: Visual C++ Express receiving a custom message Pin
martinmos24-Jul-11 1:08
martinmos24-Jul-11 1:08 
GeneralRe: Visual C++ Express receiving a custom message Pin
Richard MacCutchan24-Jul-11 1:25
mveRichard MacCutchan24-Jul-11 1:25 
GeneralRe: Visual C++ Express receiving a custom message Pin
martinmos24-Jul-11 5:37
martinmos24-Jul-11 5:37 
QuestionC program to start before windows boot Pin
ayandelhi23-Jul-11 4:31
ayandelhi23-Jul-11 4:31 
AnswerRe: C program to start before windows boot Pin
Richard MacCutchan23-Jul-11 6:22
mveRichard MacCutchan23-Jul-11 6:22 
AnswerRe: C program to start before windows boot Pin
Rajesh R Subramanian23-Jul-11 6:56
professionalRajesh R Subramanian23-Jul-11 6:56 
GeneralRe: C program to start before windows boot Pin
Albert Holguin23-Jul-11 8:07
professionalAlbert Holguin23-Jul-11 8:07 
AnswerRe: C program to start before windows boot Pin
ayandelhi23-Jul-11 22:11
ayandelhi23-Jul-11 22:11 
GeneralRe: C program to start before windows boot Pin
Richard MacCutchan23-Jul-11 22:26
mveRichard MacCutchan23-Jul-11 22:26 
GeneralRe: C program to start before windows boot Pin
ayandelhi24-Jul-11 1:03
ayandelhi24-Jul-11 1:03 
GeneralRe: C program to start before windows boot Pin
Randor 24-Jul-11 1:04
professional Randor 24-Jul-11 1:04 
GeneralRe: C program to start before windows boot Pin
ayandelhi24-Jul-11 1:10
ayandelhi24-Jul-11 1:10 
AnswerRe: C program to start before windows boot Pin
Stefan_Lang24-Jul-11 23:14
Stefan_Lang24-Jul-11 23:14 
GeneralRe: C program to start before windows boot Pin
ayandelhi25-Jul-11 1:02
ayandelhi25-Jul-11 1:02 
AnswerRe: C program to start before windows boot Pin
cmk25-Jul-11 8:44
cmk25-Jul-11 8:44 
AnswerRe: C program to start before windows boot Pin
Ni740826-Jul-11 2:01
Ni740826-Jul-11 2:01 
GeneralRe: C program to start before windows boot Pin
ayandelhi26-Jul-11 3:24
ayandelhi26-Jul-11 3:24 
QuestionProblems with structures Pin
rahul.kulshreshtha22-Jul-11 20:45
rahul.kulshreshtha22-Jul-11 20:45 
QuestionRe: Problems with structures Pin
Rajesh R Subramanian22-Jul-11 21:04
professionalRajesh R Subramanian22-Jul-11 21:04 
AnswerRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 21:31
rahul.kulshreshtha22-Jul-11 21:31 
AnswerRe: Problems with structures Pin
Rajesh R Subramanian22-Jul-11 21:37
professionalRajesh R Subramanian22-Jul-11 21:37 
GeneralRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 22:05
rahul.kulshreshtha22-Jul-11 22:05 
GeneralRe: Problems with structures Pin
rahul.kulshreshtha22-Jul-11 22:13
rahul.kulshreshtha22-Jul-11 22:13 
AnswerRe: Problems with structures Pin
John R. Shaw23-Jul-11 7:47
John R. Shaw23-Jul-11 7:47 
The only problem I see is the non-portability of writing the structure to the file instead of individual items. That is compiler structure [type] alignment dependent and may change from one compiler to the next or one version of the compiler to the next.

Your solution sounds like a simple application of the KISS principle and avoids the problems of more complex solutions. Just add a header of some kind to the file. The header should contain an identifier, marking the file as the correct type, and a version number indicating the format type (a.k.a. data type [structure type]). This also has the advantage of being cross-language and cross-platform supportable.

It sounds like all the data is read into memory at start up. In that case you only need one method (function) to read the file and convert it to the internal data structure at start up and one for writing it (if it has changed) out when shutting down.

I used the above method in a commercial application (originally written in C) that supports file formats going back over 20 years. This is comparable to reading and writing Word or other document types that contain version specific format support.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone

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.