How to open a file as binary



  • Hi everyone,
    I would like to implement the exact match of
    @fopen ("myfile.txt","ab");@
    as you know this "ab" means open a file as a binary file.

    is @file.open(QIODevice::ReadWrite)@ works as the same ?

    thanks in advance.



  • If you use QIODevice::Text, when reading, the end-of-line terminators are translated to '\n'. When writing, the end-of-line terminators are translated to the local encoding, for example '\r\n' for Win32.
    Otherwise is open like a raw binary file.



  • @file.open(QIODevice::Append)@
    is the same as
    @fopen("fnmae","ab")@



  • [quote author="stuk" date="1327937214"]If you use QIODevice::Text, when reading, the end-of-line terminators are translated to '\n'. When writing, the end-of-line terminators are translated to the local encoding, for example '\r\n' for Win32.
    Otherwise is open like a raw binary file.[/quote]

    Thanks !



  • [quote author="AcerExtensa" date="1327937473"]@file.open(QIODevice::Append)@
    is the same as
    @fopen("fnmae","ab")@[/quote]

    Thank you !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.