It's working, thank you for your help, however I have another problem with the open button, two errors:
error C2664: 'void ATL::CStringT<basetype,stringtraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [12]' to 'const wchar_t *'
caption.Format("Student: %s", name);
error C2664: 'void ATL::CStringT<basetype,stringtraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *'
this->m_StudentName.Format("%s", name);
Full code here, I try to make a open button:
void CROSH1Dlg::OnBnClickedOpen()
{
UpdateData();
CStudentGrade StdGrades;
CFile fleGrades;
TCHAR strFilter[] = _T("Student Grades (*.dnt)|*dnt|All Files (*.*)|*.*||");
CFileDialog dlgFile (TRUE,_T(".dnt"), NULL, 0, strFilter);
if( dlgFile.DoModal() == IDOK )
{
ifstream stmGrades(dlgFile.GetFileName(), ios::binary);
stmGrades.read((char *)&StdGrades, sizeof(StdGrades));
char name[40];
StdGrades.StudentName=name;
CString caption;
caption.Format("Student: %s", name);
this->SetWindowText(caption);
this->m_StudentName.Format("%s", name);
this->m_SchoolYear1 = StdGrades.SchoolYear1;
this->m_SchoolYear2 = StdGrades.SchoolYear2;
this->m_English = StdGrades.English;
this->m_History = StdGrades.History;
this->m_Economics = StdGrades.Economics;
this->m_2ndLanguage = StdGrades.Language2;
this->m_Geography = StdGrades.Geography;
this->m_Arts = StdGrades.Arts;
this->m_Math = StdGrades.Math;
this->m_Science = StdGrades.Science;
this->m_PhysEduc = StdGrades.PhysEduc;
this->m_Total = StdGrades.Total;
this->m_Average = StdGrades.Average;
}
UpdateData(FALSE);
}