Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Delimiting character in QString.readLine()

    General and Desktop
    3
    4
    7155
    Loading More Posts
    • 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.
    • A
      aetbanan last edited by

      @istream& getline (char* s, streamsize n, char delim );@

      How can I use a delimiting character as argument when dealing with QStrings?
      readLine() only takes maximum allowed line length as argument so I have to walk around?

      1 Reply Last reply Reply Quote 0
      • D
        dbzhang800 last edited by

        Sorry for my poor English, I do not understand what you want to express. what is QString.readLine() ?

        Debao

        1 Reply Last reply Reply Quote 0
        • M
          MuldeR last edited by

          I think that QString does not have a readLine() method.

          The QTextStream class does have a readLine() method which returns a QString.

          It will read one line from the stream. The end of the line can be any of these:

          • The maximum number of characters has been read
          • A line break has been encountered
          • The end of the stream (file) has been reached

          If you want to split a QString with user-defined delimiters, use QString::split() instead ;)

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply Reply Quote 0
          • A
            aetbanan last edited by

            Yes, split() is indeed the function I am looking for, thanks!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post