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. [SOLVED] Writing a new line in Qt5 is not working
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Writing a new line in Qt5 is not working

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.7k 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.
  • M Offline
    M Offline
    mant
    wrote on last edited by
    #1

    I tried both << endl and << "\n" but it doesn't write me a new line. What's wrong with it?
    I intend to do it like this?

    line1
    line2
    line3

    but when I open the file they're just

    line1line2line3

    Please suggest me some tips for this. Thank you in advance

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      What class are you using to write the file?

      What OS are you writing the file in?

      What are you using to read the file?

      Linux uses '\n' but Windows uses '\r\n' for newlines. However, if you are using Qt's text writing classes, you just provide '\n' and Qt will convert it to '\r\n' for you automatically.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        To what stream do you send it?
        Better show some code.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          minds
          wrote on last edited by
          #4

          Unix base (Linux and OSX) OS's uses "\n" while Windows uses "\r\n"

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mant
            wrote on last edited by
            #5

            Thank you all it works with ā€œ\r\nā€
            Thanks again it solved

            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