PDA

View Full Version : How to get the file handle in QT???



Gokulnathvc
9th March 2011, 05:45
Am using the following code:: but bool variable returns 0.

hMcFile=(HANDLE)(file.handle());

bRet = ReadFile( hMcFile,
buffer + sizeof(ATA_PASS_THROUGH_EX),
segFileSize,
&actualBytes,
NULL);

nish
9th March 2011, 07:00
what does the code before the first line do? You can get error info from GetLastError()

squidge
9th March 2011, 07:56
If file is an instance of QFile, then handle() does not return a suitable Win32 file handle, so you can not use Win32 functions with that handle.

Documentation quote: "This is a small positive integer, suitable for use with C library functions such as fdopen() and fcntl()."

Gokulnathvc
9th March 2011, 08:17
ErrorCode is 0 only..