Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CEdit::CreateEx Pin
Roger Stoltz12-Nov-08 10:47
Roger Stoltz12-Nov-08 10:47 
QuestionRe: CEdit::CreateEx Pin
David Crow12-Nov-08 10:22
David Crow12-Nov-08 10:22 
AnswerRe: CEdit::CreateEx Pin
Roger Stoltz12-Nov-08 8:18
Roger Stoltz12-Nov-08 8:18 
QuestionMFC ::Serialize problem! [modified] Pin
sabdalla8012-Nov-08 6:14
sabdalla8012-Nov-08 6:14 
AnswerRe: MFC Serialize Version problem! Pin
Roger Stoltz12-Nov-08 6:51
Roger Stoltz12-Nov-08 6:51 
GeneralRe: MFC Serialize Version problem! Pin
sabdalla8012-Nov-08 6:55
sabdalla8012-Nov-08 6:55 
QuestionRe: MFC Serialize Version problem! Pin
enhzflep12-Nov-08 7:39
enhzflep12-Nov-08 7:39 
AnswerRe: MFC Serialize Version problem! Pin
Roger Stoltz12-Nov-08 7:42
Roger Stoltz12-Nov-08 7:42 
sabdalla80 wrote:
void CLineClass::Serialize(CArchive& ar)
{
   if( ar.IsStoring() )
   {
      int Version = 5;
      ar << Version;
      ar << m_ChannelName << m_IsAltered << m_MaxNumberOfBoards;
      ar << m_LineAddress << m_LineColor << m_ShortChannelName;
      ar << m_LookUpTableFilename;
      ar << m_Units; // New in version 3
      ar << m_DecimalPlaces; // New in version 4
      ar << m_Description << m_PrivateNotes; // New in version 5
   }
   else
   {
      int Version;
      ar >> Version;
      ar >> m_ChannelName >> m_IsAltered >> m_MaxNumberOfBoards;
      ar >> m_LineAddress >> m_LineColor >> m_ShortChannelName;
      ar >> m_LookUpTableFilename;
      if( Version > 2 )
      {
         // New in version 3
         ar >> m_Units;
      }
      else
      {
         m_Units=0;
      }
      if( Version > 3 )
      {
         // New in version 4
         ar >> m_DecimalPlaces;
      }
      if( Version > 4 )
      {
         // New in version 5
         ar >> m_Description >> m_PrivateNotes;
      }
   }

   m_COperationArray.Serialize( ar );
   m_LookUpTableArray.Serialize( ar );
}


I've taken the liberty to format the code above to make it more readable since you didn't use the <pre></pre> tags, which you ought to when you're posting code in the forums.

You have to verify that the serialization of all classes for the member variables works properly by using the debugger.
Step through the code in CLineClass::Serialize and see at which line it asserts.

You said you wanted to increase the version number and add a variable to be serialized. Have you tried following the pattern in the code above?
I'm unable to find any error in the code you've posted so far, but you also said that version 5 worked.

Make sure you're not trying to read a file with a higher version number than the code supports by verifying that the version number in the file is less or equal to the version number of the code.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


GeneralRe: MFC Serialize Version problem! Pin
sabdalla8012-Nov-08 7:58
sabdalla8012-Nov-08 7:58 
GeneralRe: MFC Serialize Version problem! Pin
Mark Salsbery12-Nov-08 9:01
Mark Salsbery12-Nov-08 9:01 
QuestionCListCtrl - Problem with VS2008 Pin
MrNyquist12-Nov-08 5:01
MrNyquist12-Nov-08 5:01 
AnswerRe: CListCtrl - Problem with VS2008 Pin
Mark Salsbery12-Nov-08 9:08
Mark Salsbery12-Nov-08 9:08 
GeneralRe: CListCtrl - Problem with VS2008 Pin
MrNyquist12-Nov-08 21:10
MrNyquist12-Nov-08 21:10 
GeneralRe: CListCtrl - Problem with VS2008 Pin
Mark Salsbery13-Nov-08 5:41
Mark Salsbery13-Nov-08 5:41 
GeneralRe: CListCtrl - Problem with VS2008 Pin
Mark Salsbery13-Nov-08 5:57
Mark Salsbery13-Nov-08 5:57 
GeneralRe: CListCtrl - Problem with VS2008 Pin
MrNyquist14-Nov-08 1:56
MrNyquist14-Nov-08 1:56 
Questionvc6 to vc8 conversion [modified] Pin
Russell'12-Nov-08 3:56
Russell'12-Nov-08 3:56 
GeneralRe: vc6 to vc8 conversion Pin
led mike12-Nov-08 4:20
led mike12-Nov-08 4:20 
GeneralRe: vc6 to vc8 conversion Pin
Russell'12-Nov-08 4:35
Russell'12-Nov-08 4:35 
GeneralRe: vc6 to vc8 conversion Pin
led mike12-Nov-08 4:59
led mike12-Nov-08 4:59 
GeneralRe: vc6 to vc8 conversion Pin
David Crow12-Nov-08 5:40
David Crow12-Nov-08 5:40 
GeneralRe: vc6 to vc8 conversion Pin
Mark Salsbery12-Nov-08 9:10
Mark Salsbery12-Nov-08 9:10 
GeneralRe: vc6 to vc8 conversion Pin
Russell'12-Nov-08 22:12
Russell'12-Nov-08 22:12 
GeneralRe: vc6 to vc8 conversion Pin
Mark Salsbery13-Nov-08 6:19
Mark Salsbery13-Nov-08 6:19 
GeneralRe: vc6 to vc8 conversion Pin
Russell'13-Nov-08 7:54
Russell'13-Nov-08 7:54 

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.