Play with this code if you like. Just copy and paste. It will work. It will create a text file and print the time and date in it if you select .txt. If you don't select .txt you get a message box.
You'll need #include <fstream.h>
char Types[3][5] = {"NULL",".txt",".ipd"};
// setup save dialog
char saveFileName[50] = "Sort";
CFileDialog dlgFile(FALSE);
dlgFile.m_ofn.lpstrTitle = "Sort Save"; // set window title
dlgFile.m_ofn.lpstrFile = saveFileName;
dlgFile.m_ofn.nMaxFile = sizeof(saveFileName);
dlgFile.m_ofn.lpstrFilter = "Text File (.txt)\0*.txt\0Mpv File (.mpv)\0*.mpv";
// display save dialog
if(dlgFile.DoModal() == IDCANCEL){
return;
}
// add extention to file
strcat(dlgFile.m_ofn.lpstrFile,Types[dlgFile.m_ofn.nFilterIndex]);
// if user selected text
if(dlgFile.m_ofn.nFilterIndex == 1){
ofstream TextFile(dlgFile.m_ofn.lpstrFile);
CTime t = CTime::GetCurrentTime();
CString s = t.Format( "%A, %B %d, %Y %H:%M " );
TextFile << s << endl;
TextFile.close();
}
else{
AfxMessageBox("This save type is not implemented"

;
}