CFile problem ... 
Author Message
 CFile problem ...

   I want to load a file. I have a Dialog with a "Load" button, i attach code
to it :

{
 // TODO ...
   CFile f;
   CFileDialog fd;
   fd.DoModal();
   f.Open(fd.GetPath(),CFile::modeRead | CFile::modeBinary);
   f.Close;

Quote:
}

   Well,  this is maybe  not  exactly what I  have  typed in (maybe  a
letter or two are  wrong), but it has  built. Anyway, when i press the
"Load" button,  the application stops (not even  closable), I  have to
kill it via Ctrl-Alt-Suppr.

   Thank you for your help.




Sun, 22 Oct 2000 03:00:00 GMT  
 CFile problem ...

Stephane,

Here is code from where I did the same sort of thing.  I don't know what's going
wrong with yours, but maybe this will help.  The major difference here is I use
GetPathName() instead of GetPath().

CFileDialog FileList(TRUE, NULL, "*.XXX",OFN_HIDEREADONLY,
 "XXX Files (*.XXX)|*.XXX|All Files (*.*)|*.*||");
CString temp;
CFile XXXFile;
CFileException e;

// Change the title to something more appropriate than "Read"
FileList.m_ofn.lpstrTitle = "Select a XXX File to Load";

if (FileList.DoModal() == IDOK) {
     if(XXXFile.Open(FileList.GetPathName(),CFile::modeRead,&e)) {
    ...
    }

Quote:
}

>    I want to load a file. I have a Dialog with a "Load" button, i attach code
> to it :

> {
>  // TODO ...
>    CFile f;
>    CFileDialog fd;
>    fd.DoModal();
>    f.Open(fd.GetPath(),CFile::modeRead | CFile::modeBinary);
>    f.Close;
> }

>    Well,  this is maybe  not  exactly what I  have  typed in (maybe  a
> letter or two are  wrong), but it has  built. Anyway, when i press the
> "Load" button,  the application stops (not even  closable), I  have to
> kill it via Ctrl-Alt-Suppr.

>    Thank you for your help.





Sun, 22 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CFile Problem?

2. CFile problem?

3. CFile problem

4. CFile problem

5. CFile problem; writing to a file

6. CFile problems...

7. CFile problem

8. CFile problems

9. Simple CFile problem, help would be appreciated

10. CFile problem --- reading junk characters at the end of an file

11. HELP! CFile Problems

12. CFile::Open asserts on CFile::typeText

 

 
Powered by phpBB® Forum Software