Results 1 to 4 of 4

Thread: How to get the file handle in QT???

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default How to get the file handle in QT???

    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);

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get the file handle in QT???

    what does the code before the first line do? You can get error info from GetLastError()

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get the file handle in QT???

    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()."

  4. #4
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get the file handle in QT???

    ErrorCode is 0 only..

Similar Threads

  1. QTextStream and file handle
    By Dilshad in forum Newbie
    Replies: 2
    Last Post: 4th January 2011, 11:26
  2. Best way to handle XML fragments?
    By pherthyl in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2010, 18:21
  3. How to handle: QtCore/qconfig.h: No such file or directory ?
    By owen_263 in forum Installation and Deployment
    Replies: 2
    Last Post: 7th April 2008, 09:54
  4. How to Handle new Qt?
    By ashukla in forum General Programming
    Replies: 3
    Last Post: 3rd March 2008, 11:50
  5. Windows file handle on QFile?
    By Teerayoot in forum Qt Programming
    Replies: 4
    Last Post: 14th May 2007, 11:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.