|
-
December 26th, 2007, 02:09 AM
#1
FILE vs CFile
Anyway to do conversion between FILE and CFile object?
-
December 26th, 2007, 02:59 AM
#2
Re: FILE vs CFile
CFile is a MFC class meanwhile FILE is a data type of ANSI C.
My English is not good. So you maynot understand what I say! 
-
December 26th, 2007, 03:51 AM
#3
Re: FILE vs CFile
Yes. and any way to convert an CFile object to FILE stream?
(Or let a FILE stream pointer point to CFile object and get the correct result?)
-
December 26th, 2007, 07:36 AM
#4
Re: FILE vs CFile
FILE* to CFile
Code:
FILE* f = fopen(path, szMode);
int handle = f->_file;
HANDLE hFile = (HANDLE) _get_osfhandle(handle);
CFile cf(hFile);
CFile to FILE*
Code:
CFile cf;
cf.Open(...);
HANDLE hFile = cf;
int handle = _open_osfhandle((LONG)hFile, _mode);
FILE* f = fdopen(handle, szMode);
Last edited by Igor Vartanov; December 26th, 2007 at 07:39 AM.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|