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. Qtextstream and Qfile
Servers for Qt installer are currently down

Qtextstream and Qfile

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.8k 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
    MFreeM
    wrote on last edited by
    #1

    Hi guys,

    I'm using the above to create a bat file and dumping it over the network. I'm having a bit of a problem.
    when streaming text to the file it doesn't recognize << endl; or "/n".

    Also, i'm having a bit of a problem with / slashes.

    What is the best file class to use for batch files and how can i make the qtextstream to recognize new line symbols?

    Thanks

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You have to use the backslash. It is '\n' for a new line.
      On which OS are you working. Apparently, you are working on a windows platform, since yu write a bat-file. How do you know, that the new line is not written?
      Some viewers do not recognize newline only.
      What problems do you have with '/'?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MFreeM
        wrote on last edited by
        #3

        Thanks for your reply.

        Im working on windows, have realised my typo, have used the backslash with no joy.
        I know it hasnt read tge newline as the bat file has got all text on one line.
        Ive sorted the backslash problem, you just have to.double up with i forgor about.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          Well, as I wrote seeing all text in one line does not necessarily mean that there is no newline in windows.
          Do you have a lister allowing to see it as hex?

          You may also try to write '\r' and '\n' at the line end.

          [Edit] Just saw this in the doc:
          [quote]Note: On Windows, all '\n' characters are written as '\r\n' if QTextStream's device or string is opened using the QIODevice::Text flag.
          [/quote]
          So if you write on windows the translation is enforced in Qt. Do you open the file as a text file as recommended?

          Vote the answer(s) that helped you to solve your issue(s)

          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