Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

FILE* Pointer frol CFile object?

I have integrated some external code in my project that wants me to write my data into a CFile (CSharedFile to be exact). But since my data model requires a FILE* pointer to for its IO-operations I wondered if there's any way to get a FILE* pointer from the CFile object.

I think that the CFile class is simply a wrapper for the fopen, fwrite, fread, etc. functions. Right? So there should be a way.

I tried to get the file handle (with the HANDLE operator of CFile) and cast it into FILE*, but the handle I got was invalid (0xffffffff).

Grateful for any ideas.
0
hirnsieb
Asked:
hirnsieb
1 Solution
 
Karl Heinz KremerCommented:
I think what you want is the m_hFile member variable instead of the HANDLE operator. Unfortunately, this is still not useable like a FILE pointer, but must be converted to one first.

See the page at http://www.flounder.com/handles.htm for some background information and code snippets.
0
 
hirnsiebAuthor Commented:
the link you provided was very useful, although i now know that what i wanted to do is impossible. so i altered my code. thanks anyway!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now