Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

in.device()->read(); doesn't work in release mode



  • I have a binary file from where I'm reading values using in.device()->read(4);
    The first four bytes of the file is the first value, the second four bytes is the second value, etc...
    There are 9 values in a file, and QT reads all of them perfectly in debug mode, but in release mode, it reads the fifth value as zero. To be specific, in debug mode, QT reads the fifth value as "\x07\x00\x00\x00", and in release mode it reads fifth value as "\x00\x00\x00\x00".

    Initially, I thought I had a bug in my code but then I discovered (using qDebug()) that the problem lies within in.device()->read() method. Is it possible to fix this, or is this a QT Bug?


  • Lifetime Qt Champion

    Hi,

    Which version of Qt ?
    Which OS ?
    Where is that file located ?
    Can you provide a minimal compilable example with a test file ?



  • @jellyv said in in.device()->read(); doesn't work in release mode:

    perfectly in debug mode, but in release mode

    Are the environment (i.e. starting folder) the same based on the different modes?


Log in to reply