Is there anything for getting right end-of-line symbol for any platform? I mean, I can use \\n
for Windows and Unix if I want to write EOL to file, but there is
I use this bit of code:
const QChar newline(QChar('\n'));
const QChar cr('\r');
#ifdef __linux__
const QChar eol = newline);
#elif _WIN32
const QString eol = QString(cr) + QString(newline);
#else
const QChar eol = cr;
#endif
I have not tested the else branch because I do very little work on systems that aren't either linux or windows (mac for example), so one would have to test that one's self.
The linux, and windows branches work well for me for splitting strings into lines on windows and linux.