Can't display a file in an SDI MFC application
Hello all,
I'm trying to develop a very simple text editor with VC++, the MFC and the SDI framework. I'm using the CEditView class and I started off with the SDI application skeleton from the VC++ wizard. I am experiencing weird symptoms - or at least they seem so to me.
I can enter text in my view and it gets displayed properly, but whenever I try to open a file (using WinApp::OnFileOpen), all I get on my screen are | characters and not the actual text contained in the file. My code is very similar to the multipad sample except that it's using the SDI framework and not the MDI one, and I'm having a hard time figuring out what's wrong.
My apologies if I'm not describing my problem well, I am a total beginner with VC++ and the MFC :-). Any help would be greatly appreciated.
Thanks,
Maxime
Re: Can't display a file in an SDI MFC application
Here are a few comments a few years on for what its worth:
CEditView has a method called SerializeRaw() which is different to all the other Serialize() methods. For loading Serialize() expects the first two words to be size information. If you have a normal text file and use Serialize(), then the first two characters ascii value is interpreted as numbers. Then Serialize() reads that much data, which may be over the end of the file and look like garbage. SerializeRaw() expects a normal text file with no size information in the first couple of words.
Allan