problem in opening a file in MFC.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shakthi
    New Member
    • Sep 2006
    • 13

    problem in opening a file in MFC.....

    hi all,
    Am trying to create a dialog box that displays a list of files.I want to open a selected file from that list when a button is clicked.The function is as follows.

    void CdialogDlg::OnB nClickedButton1 ()
    {
    CFile f;


    CFileDialog FileDlg(TRUE, NULL, NULL, 0,NULL,NULL);



    if( FileDlg.DoModal () == IDOK )
    {

    opens = FileDlg.GetFile Name();
    f.Open(opens,CF ile::modeRead);


    }


    When running this a dialog box opens,but when i select a file and click it,i cannot view its contents.Is there any other function to view the contents?Am so confused coz am very new to MFC programming.Ple ase guide me whatt to do.
    Any help will be appreciated.

    Thanks a lot in advance.







    }
Working...