Solved

CFile::Write question

Posted on 2004-10-21
215 Views
Last Modified: 2013-11-20
I have a SDI app w/ a listview. a property sheet will open, user will fill in the fields, and data goes to the listview and property sheet closes.
normally when using a listview i use the serialize function to save data, but i need to save listview data as plain text, so i tried to use CFile::Write method. the problem is when using
file.WriteString(m_edit1);
it only writes the last entry from m_edit1, unlike the serialize function which will save all the m_edit1 entries in the view. is there any way to achieve this using CFile::Write?
0
Question by:cheapstr
    3 Comments
     
    LVL 55

    Accepted Solution

    by:
    You have to make a loop to write every item in the list view.
    0
     
    LVL 23

    Expert Comment

    by:Roshan Davis
    open the file with the attribute CFile::modeNoTruncate
    ~rosh
    0
     
    LVL 43

    Expert Comment

    by:AndyAinscow
    Have a look at the code in the serialize function and make a duplicate of the IsSaving section but replace the lines ar<< xxxxx with your file.WriteString
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
    Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    This video discusses moving either the default database or any database to a new volume.

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now