Click here to Skip to main content
15,898,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC6 in Visual Studio.NET Pin
AlexMarbus9-Apr-02 22:08
AlexMarbus9-Apr-02 22:08 
GeneralRe: MFC6 in Visual Studio.NET Pin
Mazdak10-Apr-02 0:16
Mazdak10-Apr-02 0:16 
GeneralRe: MFC6 in Visual Studio.NET Pin
AlexMarbus10-Apr-02 1:11
AlexMarbus10-Apr-02 1:11 
GeneralRe: MFC6 in Visual Studio.NET Pin
Mazdak10-Apr-02 1:35
Mazdak10-Apr-02 1:35 
GeneralRe: MFC6 in Visual Studio.NET Pin
AlexMarbus10-Apr-02 3:00
AlexMarbus10-Apr-02 3:00 
GeneralRe: MFC6 in Visual Studio.NET Pin
Mazdak10-Apr-02 3:12
Mazdak10-Apr-02 3:12 
GeneralRe: MFC6 in Visual Studio.NET Pin
AlexMarbus10-Apr-02 3:59
AlexMarbus10-Apr-02 3:59 
GeneralSerialization & Reading/Write Multiple Lines :: MFC Pin
valikac9-Apr-02 21:47
valikac9-Apr-02 21:47 
Hello.

My intention is to read each line from a file and save it into a STL list of CString. So if there are 10 lines in the file, then the linked list of CString will be of size ten. Prosise demonstrates a very effective way to read and write from and to a file linewise using the CStdioFile class. However, in doc/view, MFC turns to Serialization. The problem, to me, with Serialization is I do not know what is going on in the background. I do not know what the framework does to the data in terms of CArchive.

When writing to CArchive, I use this:

for (iter = list.begin(); iter != list.end(); ++iter)
ar << *iter;

I am not sure how to read data from CArchive back into the linked list. First, I do not know whether data is stored similar to a file, i.e. if you write line1 and line2, then you can read back line1 and line2 in its original form.

How should I go about read data from CArchive back into the linked list if I have no knowledge of how CArchive manages the orientation of the data?

For example let say that the linked list of CString has this:

-----
a
b
c
d
e
-----

Okay. When it stores the data into CArchive, I assumpt it stores it like this:

<- a <- b <- c <- d <-e

However, if I have no prior knowledge of what was in the CArchive, how do I go about saving the data from CArchive back into the linked list?

Thanks,
Kuphryn

Note: If nothing works, I think the technique Prosise shows is best since class CStdioFile features ReadString() and WriteString().
GeneralRe: Serialization & Reading/Write Multiple Lines :: MFC Pin
Alexandru Savescu9-Apr-02 22:10
Alexandru Savescu9-Apr-02 22:10 
GeneralRe: Serialization & Reading/Write Multiple Lines :: MFC Pin
valikac10-Apr-02 4:53
valikac10-Apr-02 4:53 
GeneralRe: Serialization & Reading/Write Multiple Lines :: MFC Pin
AlexMarbus10-Apr-02 5:15
AlexMarbus10-Apr-02 5:15 
GeneralRe: Serialization & Reading/Write Multiple Lines :: MFC Pin
valikac10-Apr-02 14:44
valikac10-Apr-02 14:44 
GeneralRe: Serialization & Reading/Write Multiple Lines :: MFC Pin
Ravi Bhavnani10-Apr-02 5:22
professionalRavi Bhavnani10-Apr-02 5:22 
GeneralSave as a database file Pin
Phlegm9-Apr-02 21:39
Phlegm9-Apr-02 21:39 
GeneralRe: Save as a database file Pin
Mazdak10-Apr-02 0:16
Mazdak10-Apr-02 0:16 
GeneralChoose between C runtime library and Win32 API Pin
NicholasCougar9-Apr-02 19:43
NicholasCougar9-Apr-02 19:43 
GeneralRe: Choose between C runtime library and Win32 API Pin
Christian Graus9-Apr-02 22:09
protectorChristian Graus9-Apr-02 22:09 
GeneralRe: Choose between C runtime library and Win32 API Pin
Nish Nishant10-Apr-02 0:59
sitebuilderNish Nishant10-Apr-02 0:59 
GeneralProblem with porting 98 to 2K serial comms Pin
9-Apr-02 18:58
suss9-Apr-02 18:58 
GeneralRe: Problem with porting 98 to 2K serial comms Pin
Roger Allen10-Apr-02 0:37
Roger Allen10-Apr-02 0:37 
QuestionHow do I keep a ListCtrl visible? Pin
shypht9-Apr-02 17:24
shypht9-Apr-02 17:24 
AnswerRe: How do I keep a ListCtrl visible? Pin
Shog99-Apr-02 18:17
sitebuilderShog99-Apr-02 18:17 
GeneralRe: How do I keep a ListCtrl visible? Pin
shypht9-Apr-02 18:32
shypht9-Apr-02 18:32 
GeneralHrmm, one problem I just noticed Pin
shypht9-Apr-02 18:50
shypht9-Apr-02 18:50 
GeneralChange Toolbar Dialog Size Pin
Matt Newman9-Apr-02 16:46
Matt Newman9-Apr-02 16:46 

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.