Hi Francesc,
I don't know about Windows.
I didn't look at H5Fget_vfd_handle, but from the signature I expected
it to give you a FILE*. Now I see it gives you a pointer to the file
handle, so it depends on the underlying file driver what you'll get.
Ger
Francesc Alted <faltet@pytables.com> 09/08/08 2:27 PM >>>
Hi Ger,
A Monday 08 September 2008, Ger van Diepen escrigué:
Hi Francesc,
Converting a pointer to int is very bad practice. On 64-bit machines
an int is often 32 bits, so it may well fail as it is too short for
the 64-bit pointer. ptrdiff_t is defined as the integer type with
the
correct precision.
That's a good point. However, I want to pass it to low-level OS
functions (fcntl, flock, lockf, dup2 style), where they are requiring
the descriptor to be an 'int', so I suppose that the file handler will
never require more that 32-bit -- at least in Linux, but I'm not sure
about other OS, specially Windows; this is why I was asking.
Thanks,
Francesc
>>> Francesc Alted <faltet@pytables.com> 09/08/08 10:11 AM >>>
Hi,
I'm trying to get the OS file handler out of a HDF5 'hid_t file_id'
identifier. The signature for the function that should do this in
HDF5 is:
H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle)
[BTW, the reference manual is wrong about this signature]
Now, I had to convert the 'file_handle' variable into a typed (i.e.
not 'void') variable so as to be able to deal with it in Python and
pass it to its fcntl module (in order to do operations on the
handler). I've chosen a regular 'int' for keeping the handle
information and, apparently, it works well on Linux and H5P_DEFAULT
driver.
My question is: do you think that converting the 'void
**file_handle'
···
into an integer is a good practice in general, or there are cases
where this conversion would not work?
Thanks,
--
Francesc Alted
Freelance developer
Tel +34-964-282-249
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to
hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.