Click here to Skip to main content
15,913,210 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: fatal error C1001: INTERNAL COMPILER ERROR Pin
Abhi Lahare16-Dec-09 3:09
Abhi Lahare16-Dec-09 3:09 
GeneralRe: fatal error C1001: INTERNAL COMPILER ERROR Pin
Fatbuddha 116-Dec-09 5:55
Fatbuddha 116-Dec-09 5:55 
AnswerRe: fatal error C1001: INTERNAL COMPILER ERROR Pin
22491716-Dec-09 12:00
22491716-Dec-09 12:00 
GeneralRe: fatal error C1001: INTERNAL COMPILER ERROR Pin
wangningyu20-Dec-09 5:00
wangningyu20-Dec-09 5:00 
QuestionC++ File system Pin
hrishiS16-Dec-09 1:13
hrishiS16-Dec-09 1:13 
AnswerRe: C++ File system Pin
CPallini16-Dec-09 1:53
mveCPallini16-Dec-09 1:53 
GeneralRe: C++ File system Pin
hrishiS16-Dec-09 2:16
hrishiS16-Dec-09 2:16 
GeneralRe: C++ File system Pin
CPallini16-Dec-09 2:36
mveCPallini16-Dec-09 2:36 
You may do a step toward serialization, storing type info just before actual data, for instance:
enum SER_TYPES
{
  eTypeI,
  eTypeD,
  //..
};

struct I
{
   int i1, i2;
};
struct D
{
   double d1, d2, d3;
};
// ..

void store(FILE *fp, I * pi)
{
  int t = eTypeI;
  fwrite( &t, sizeof(int), 1, fp); // first write type
  fwrite( pi, sizeof(*pi), fp); // then write data
}
void store(FILE *fp, D * pd)
{
  int t = eTypeD;
  fwrite( &t, sizeof(int), 1, fp); // first write type
  fwrite( pd, sizeof(*pd), fp); // then write data
}

int main()
{
  FILE * fp = fopen("data.raw", "wb");
  I i,j;
  D d,f;
  //..
  store(fp,i);
  store(fp,d);
  store(fp,j);
  //..
}


On reading, you've to first read the type of the stored data and then, according to the type, read the actual data.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: C++ File system Pin
hrishiS16-Dec-09 2:48
hrishiS16-Dec-09 2:48 
QuestionCall a function from another class Pin
Paulraj G16-Dec-09 0:22
Paulraj G16-Dec-09 0:22 
AnswerRe: Call a function from another class Pin
Richard MacCutchan16-Dec-09 0:39
mveRichard MacCutchan16-Dec-09 0:39 
GeneralRe: Call a function from another class Pin
Paulraj G16-Dec-09 1:00
Paulraj G16-Dec-09 1:00 
GeneralRe: Call a function from another class Pin
WoutL16-Dec-09 1:18
WoutL16-Dec-09 1:18 
GeneralRe: Call a function from another class Pin
Paulraj G16-Dec-09 1:20
Paulraj G16-Dec-09 1:20 
GeneralRe: Call a function from another class Pin
Richard MacCutchan16-Dec-09 1:18
mveRichard MacCutchan16-Dec-09 1:18 
AnswerRe: Call a function from another class Pin
Nelek16-Dec-09 5:35
protectorNelek16-Dec-09 5:35 
QuestionChoosing of STL container Pin
hrishiS15-Dec-09 23:35
hrishiS15-Dec-09 23:35 
AnswerRe: Choosing of STL container Pin
Adam Roderick J16-Dec-09 0:05
Adam Roderick J16-Dec-09 0:05 
GeneralRe: Choosing of STL container Pin
hrishiS16-Dec-09 0:52
hrishiS16-Dec-09 0:52 
AnswerRe: Choosing of STL container Pin
Jonathan Davies16-Dec-09 0:06
Jonathan Davies16-Dec-09 0:06 
GeneralRe: Choosing of STL container Pin
hrishiS16-Dec-09 0:52
hrishiS16-Dec-09 0:52 
AnswerRe: Choosing of STL container Pin
CPallini16-Dec-09 0:08
mveCPallini16-Dec-09 0:08 
AnswerRe: Choosing of STL container Pin
KingsGambit16-Dec-09 1:00
KingsGambit16-Dec-09 1:00 
QuestionThreads and Sockets Pin
giancoitaly15-Dec-09 21:56
giancoitaly15-Dec-09 21:56 
AnswerRe: Threads and Sockets [modified] Pin
Adam Roderick J15-Dec-09 23:31
Adam Roderick J15-Dec-09 23:31 

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.