TCHAR '\' use, adds space
When Im using the following code
Code:
CString cstrTemp = _T("Sample text goes here Line 1\
Sample text goes here Line 2\
Sample text goes here Line 3\");
AfxMessageBox (cstrTemp);
this code adds tabs to my text on messagebox. used '\' for next line code.
Re: TCHAR '\' use, adds space
Quote:
Originally Posted by
hypheni
When Im using the following code
Code:
CString cstrTemp = _T("Sample text goes here Line 1\
Sample text goes here Line 2\
Sample text goes here Line 3\");
AfxMessageBox (cstrTemp);
this code adds tabs to my text on messagebox. used '\' for next line code.
What does that do?
Also, didn't the compiler warn you of an invalid escape sequence on that line?
Regards,
Paul McKenzie
Re: TCHAR '\' use, adds space
Are you trying to get three lines in your edit control or just continue your code on the next line?
Re: TCHAR '\' use, adds space
Quote:
used '\' for next line code.
This instructs to escape the LF symbol at the end of the line, but leading tab symbol on the next line is still there. That one you have in the message box. :)
In fact the three lines should be glued like this:
Code:
CString cstrTemp = _T("Sample text goes here Line 1\n")
_T("Sample text goes here Line 2\n")
_T("Sample text goes here Line 3");
Re: TCHAR '\' use, adds space
Yes Im trying to continue my code next line.
Igor your method worked.
Re: TCHAR '\' use, adds space
Quote:
Originally Posted by
hypheni
Yes Im trying to continue my code next line.
and, if the next line has tabs, then logically, the resulted string will contain tabs.
Quote:
Igor your method worked.
Of course, that way you have to write.