Solved

FILE* Pointer frol CFile object?

Posted on 2003-11-21
2
299 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 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

23 Experts available now in Live!

Get 1:1 Help Now