hello I'm new to this and will like some help. I will like to create a visual program with to command buttons, the first to open a file by having the user choose the file and the second command button is to open the file and read in the text. here is what I have which gives 2 errors and a warning:
void CUltraReadDlg::OnOpen()
{
//MY CODE STARTS HERE
typedef struct tagOFN { //ofn
LPCTSTR lpstrFilter;
LPCTSTR lpstrInitialDir;
} OPENFILENAME;
CFileDialog m_ldFile(TRUE);
// Initialize the starting directory
m_ldFile.m_ofn.lpstrInitialDir="C:\\Temp\\";
// Show the file open dialog and capture the result
if (m_ldFile.DoModal() == IDOK)
{ m_sResults = m_ldFile.GetPathName() + m_ldFile.GetFileName();
UpdateData(FALSE);
}
void CUltraReadDlg::OnRun()
// //MY CODE STARTS HERE
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ifstream m_fileRead(m_sResults);
if (m_fileRead.fail()) {
cerr << "unable to open file for reading." <<endl;
exit(1);
}
string nextToken;
while (inFile >> nextToken){
cout << "Token: " << nexttoken << endl;
}
m_fileRead.close();
return 0;
}
//END OF MY CODE
}