Delimiting character in QString.readLine()

  • @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?

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


  • 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 ;)

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

Log in to reply

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