Solved

FILE* Pointer frol CFile object?

Posted on 2003-11-21
2
302 Views
Last Modified: 2013-11-20
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
Comment
Question by:hirnsieb
2 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 125 total points
ID: 9799556
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
 
LVL 1

Author Comment

by:hirnsieb
ID: 9800290
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now