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("a:\\capl.dat"
while(!inFile.eof())
{
getline(inFile,m_Dave);
theVector.push_back(m_Dave);
}
ofstream outFile("a:\\dave.txt"
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
#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("a:\\capl.dat"
while(!inFile.eof())
{
getline(inFile,m_Dave);
theVector.push_back(m_Dave);
}
ofstream outFile("a:\\dave.txt"
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