By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

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

P: 13
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::OnBnClickedButton1()
{
CFile f;


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



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

opens = FileDlg.GetFileName();
f.Open(opens,CFile::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.Please guide me whatt to do.
Any help will be appreciated.

Thanks a lot in advance.







}
Nov 7 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.