[Qt-interest] \n problem...

Ian Thomson Ian.Thomson at iongeo.com
Wed Feb 10 17:12:10 CET 2010


Hi,

amulya rattan wrote:
> Question:
> WHY is this happening??

\n is not escaped when read from a file. It is escaped when source code 
is compiled. Your text literally contains a backslash followed by an n. 
In source code this would look like "\\n" because \\ is the escape code 
for a backslash.

To get around this, replace "\\n" with "\n" in the text you have read 
from the file. In other words, replace the literal '\n' which is 
represented as "\\n" in source, with a return code which is represented 
as "\n" in source.

Cheers,
Ian.



More information about the Qt-interest-old mailing list