Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getline with CString class in VC++6.0

Status
Not open for further replies.

hedgracer

Programmer
Mar 21, 2001
186
US
I am trying to utilize a getline function with the CString class in VC++6.0. My code is as follows:#include "stdafx.h"
#include "oboy.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;



using namespace std;
typedef vector<CString>INTVECTOR;


int main()
{


INTVECTOR theVector;
INTVECTOR::iterator theIterator;

CString m_Dave;

ifstream inFile(&quot;a:\\capl.dat&quot;);
while(!inFile.eof())
{
getline(inFile,m_Dave);
theVector.push_back(m_Dave);
}

ofstream outFile(&quot;a:\\dave.txt&quot;);

for(theIterator = theVector.begin();theIterator != theVector.end(); theIterator++)
{
outFile<<*theIterator<<endl;
}
return 0;
}
This seems so simple (it worked in a console app not utilizing MFC with a simple string variable)but the compiler is complaining that it wants three arguments instead of two (even though two worked in the console app). The only reason I wanted to work with CString is because I would like to utilize the trim functions it provides. Any suggestions? Thanks.

Dave Christman

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top