Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to open a file as binary
Forum Updated to NodeBB v4.3 + New Features

How to open a file as binary

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thehilmisu
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

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

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thehilmisu
          wrote on last edited by
          #4

          [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 !

          1 Reply Last reply
          0
          • T Offline
            T Offline
            thehilmisu
            wrote on last edited by
            #5

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

            Thank you !

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved