Qt World Summit: Register Today!

Convert QFile to FILE*

  • HI guys,
    I m trying to convert a QFile to FILE* but i get en error :
    Failed to open goforward.raw: Bad file descriptor
    The program has unexpectedly finished.@

    this is my code:
    @QFile myFile("goforward.raw");
    int FileDescriptor = myFile.handle();
    qDebug() <<FileDescriptor;
    FILE* fh = fdopen(FileDescriptor, "rb");@

  • the handle function deliveres an invalid handle as the file is not opened.

    call myFile.open(...) and try again.

  • Thanks Gerolf this is the second time you helped me solving my problem.

    you are great :)

Log in to reply