LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   MFC file serialization (https://www.linuxquestions.org/questions/programming-9/mfc-file-serialization-49252/)

t1mc00per 03-11-2003 05:00 AM

MFC file serialization
 
I am attempting to write a music manuscript writer using Visual C++ and MFC. At the moment I just want the program to read in a text file, and depending on what character is read, output some text to the screen.
I've got the outputting to screen sorted with the OnDraw() function of my View class, but how would I go about reading in a text file?

Is using Serialize() the best way, or is there a simpler way considering I only want to read in a text file and process it?

niknah 03-15-2003 06:53 AM

this is linuxquestions.org you would get more answers if you asked in a MFC forum.

try looking up CFile in MFC.

jamestwok 03-16-2003 02:58 AM

I really wouldn't bother with serialization. Its main use is for restoring an object to a saved state. You are much better off learning either how to use C++ OS streams - which I never can be bothered to do, or how to use the standard ANSI C file io routines which are very straight forward: these are

fopen
fprintf
fscanf
fclose

If you want to stick with MFC routines, then CStdioFile is the class to use for text files - it's basically a wrapper around CFile.

James


All times are GMT -5. The time now is 12:01 AM.