473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get Win32 handle from FILE*

PLS
I'm writing native C++ using VS2005.

I have a FILE* for a file opened with fopen. I want to get the WIN32
file handle for this file so I can call GetFileTime on it.

I can get the descriptor number with _fileno, but there doesn't seem to
be a function to give me the handle from the descriptor number.

Any ideas how I can do this?

Thanks,
++PLS
Nov 29 '07 #1
1 4609
Use _fileno followed by _get_osfhandle.

Regards,

Brian Muth

"PLS" <no****@nowhere.comwrote in message news:MP************************@msnews.microsoft.c om...
I'm writing native C++ using VS2005.

I have a FILE* for a file opened with fopen. I want to get the WIN32
file handle for this file so I can call GetFileTime on it.

I can get the descriptor number with _fileno, but there doesn't seem to
be a function to give me the handle from the descriptor number.

Any ideas how I can do this?

Thanks,
++PLS
Nov 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
2
by: Jorgen Grahn | last post by:
I couldn't think of a good solution, and it's hard to Google for... I write python command-line programs under Win2k, and I use the bash shell from Cygwin. I cannot use Cygwin's python package...
28
by: Grant Edwards | last post by:
I finally figured out why one of my apps sometimes fails under Win32 when it always works fine under Linux: Under Win32, the pickle module only works with a subset of floating point values. In...
0
by: rtm | last post by:
I am interested in running a process with a timeout. Also I'm interested in analyzing the output of this process. Under Unix, the solution is described clearly in the Perl Cookbook "16.10: ...
2
by: mlc | last post by:
I have a server (in win32 C++, TCP) that listens and accepts socket calls, then via CreateProcess and handle inheritence over the command line starts up a process to handle the client request. Is...
2
by: Shawn Anderson | last post by:
Anyone know how I can get a Win32 HANDLE from a StreamReader or StreamWriter? I want to work with some I/O using Win32 APIs, but I would like to attach the I/O to a .NET Stream class. Any...
0
by: Mythran | last post by:
I wrote some code that is supposed to enumerate through the specified file's win32 resources and return a string-array of all icon names. When it runs, it returns a string-array with a bunch of...
0
by: David | last post by:
I've just recently read several articles that state that the only way to write "sparse zeros" to an NTFS5 sparse file is to use Win32 DeviceIoControl with FSCTL_SET_ZERO_DATA in order to specify...
2
by: Steve Richter | last post by:
using vs2005, the wizard created a c++ forms project for me. Now in the form1.h file I have a menu item click handler that I would like to add some win32 api code to: private: System::Void...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.