Solved

FILE* Pointer frol CFile object?

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 80
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 472
Macro to save highlighted rows as a separate file 5 45
Not needed 13 119
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.

856 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