Home > Back-end >  MFC opens a dialog box, read TXT, displayed. Compile all no problem, execution will collapse, what i
MFC opens a dialog box, read TXT, displayed. Compile all no problem, execution will collapse, what i

Time:09-22

Void Ctest1View: : OnDlgopen ()
{
//TODO: add the command handler code
CFileDialog fileDlg (TRUE);
FileDlg. M_ofn. LpstrFilter=_T (" Text Files (*.txt) \ 0 *. TXT \ 0 all Files (*. *) \ 0 *. * \ \ 0 0 ");
FileDlg. M_ofn. LpstrFileTitle=_T (" open file ");
Char szChar [50].
Memset (szChar, 0, 50);
If (fileDlg DoModal ()==IDOK)
{
CFile file (fileDlg. M_ofn., CFile: : modeRead);
File. Read (szChar, 50);
File. The Close ();
USES_CONVERSION;
MessageBox (A2W (szChar));
}
}

CodePudding user response:

CFile file (fileDlg. M_ofn., CFile: : modeRead);
This isn't a clear ah, still can compile?
  • Related