Solved

FILE* Pointer frol CFile object?

Posted on 2003-11-21
2
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
deburging in oracle form 12 119
no14 challenge 14 77
how to use laptop or pad camera in vb.net windows application 2 130
Message not shown 5 104
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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