QTextStream readLine new line

QTexStream::readLine() function is a convenient function that can read a line from a file at a time. However, you must pay attention to so called new line. You may find what readLine reads are multiple lines as seen in your text editor like notepad or wordpad. So a line as seen by readLine is not a line in the eyes of your text editor. In fact, the readLine function reads all characters before a LF(Line Feed, ascii decimal code 10, hex code 0x0a) character and calls those characters a line. Those characters may include CRs(Carriage Return, ascii decimal code 13, hex code 0x0d). Many text editors show what follow CR on a new line as well(All text editors show what follow LF in a new line). This is the reason why a line read by QTexStream::readLine() looks as if it has more than one line in your editor.

Although a line read by QTexStream::readLine()  can include CRs in middle of it, it never includes the trailing end-of-line characters such as “\n” or “\r\n” so you do not need to call QString::trimmed to get rid of them.

 

 

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Leave a Reply