Change -
while(!file.eof())
to -
while(file.get(x))
I tried that, no errors, but it turns my input into garbage (jibberish).
The way that I ended up fixing it was to put a carage return at the end of the .txt file and taking this line of code out:
Code:
//MessageBox(buffer,NULL,MB_OK); //Test buffer
m_drItems.AddString(buffer);
m_drItems.SetWindowText(buffer);
Then I moved these lines:
Code:
char x[1000000]; //make big enough to cover file
CString buffer;
To the top of the file under the line that says:
Code:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Global variables///////////////
char x; //// x for buffer to load from file
CString buffer; //// buffer for ifstream
/////////////////////////////////
Changed char x[1000000]; to char x;
>>C:\dave\mita\mitaDlg.cpp(112) : error C2660: 'eof' : function does not take 1 parameters
This is probly due to the fact of giving this line of code perameters: while(!file.eof()) you have to leave it empty. If you put: while(!file.eof(x)) this could be the problem.
>>C:\dave\mita\mitaDlg.cpp(119) : error C2039: 'AddString' : is not a member of 'CString'
>>c:\program files\microsoft visual studio\vc98\mfc\include\afx.h(368) : see declaration of 'CString'
If you did everythig explaned in the first code + the changes it shoud work. I know it compiles for me.