[Qt-interest] Cross platform new line character

Farid Derradji farid.derradji at ITWM.fraunhofer.de
Thu Apr 2 15:29:54 CEST 2009


Hello Raja,

> I run into this problem of having to insert a new line character in a
> string. Since Linux and Windows use different systems for  new line
> characters, how do i add a new line character without worrying about the
> platform?

If you use Class QTextStream, this problem should be solved by Qt
internally.

> Also, Will inserting "\r\n" work in all platforms?

No. But, if you use Class QTextStream and its device or string is opened
using the QIODevice::Text flag, just insert "\n".


Regards
Farid



More information about the Qt-interest-old mailing list