Solved

Easy: Append line to CStdioFile

Posted on 1999-01-03
1
2,926 Views
Last Modified: 2013-11-20
Here's an easy one for you experts...
I need to open a file and append one line to it. I tried the following code, but it just overwrites the text in the file:

CStdioFile objFile( (LPCTSTR) m_strCurrentExportFile,  CFile::modeCreate |CFile::modeWrite |CFile::typeText );
         
objFile.SeekToEnd();
objFile.WriteString( (LPCTSTR) strOutput );      
objFile.Close();

0
Comment
Question by:MelissaC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 1327155
Hi! Yor modes for opening file is incorrect. CFile:modeCreate - truncate file to 0 if it already exist. You must check if file to append already exist and add CFile::modeCreate if it isn`t true.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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