Hey I work with similar programs I read excel files, in a .csv (comma seperated values)format and this a piece of code:
Function1()
{
CString m_fname;
CFileDialog dlg(true, NULL, _T("*.csv"), NULL, false, NULL);
dlg.m_ofn.lpstrTitle = _T("Select data file");
dlg.m_ofn.lpstrFilter = _T("Npd Files (*.npd)\0*.npd\0CSVFiles(*.csv)\0*.csv\0All Files\0*.*\0\0");
dlg.m_ofn.lpstrInitialDir = m_fname; /
if (dlg.DoModal() == IDOK)
{
m_fname = dlg.GetPathName();
function2(m_fname);
}
}
___________________________________________________________________________
Function1()
{
CStdioFile csf;
CStdioFile outFile;
CString buffer;
CString outDir;
CEvoFileDlg flDlg(EVODLG_SAVE, outDir, _T("*.txt"));
flDlg.SetTitle(_T("Select Report File"));
flDlg.SetFilter(_T("Text File (*.txt)|*.txt|All Files (*.*)|*.*||"));
if (flDlg.ShowModal() != IDOK)
return;
CStdioFile out;
if (!out.Open(dlg.GetPathName(), CFile::typeText | CFile::modeCreate | CFile::modeWrite | CFile::shareDenyWrite))
{
Evo::Alarm(23, ALM_NOTIFY, _T("Unable to open file: %s"), m_outDir);
return;
}
double val1, val2;
if (csf.Open(fname, CFile::modeRead))
{
while (csf.ReadString(buffer) )
{
out = swscanf_s(buffer,_T("%f,%f" ), val1, val2);
out.WriteString(your function that returns a string of values)
}
csf.close();
}
}
Hope this helps