|
-
November 1st, 2011, 05:53 AM
#1
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.
◄◄ hypheni ►►
-
November 1st, 2011, 07:32 AM
#2
Re: TCHAR '\' use, adds space
 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
-
November 1st, 2011, 07:37 AM
#3
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?
-
November 1st, 2011, 02:08 PM
#4
Re: TCHAR '\' use, adds space
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");
Best regards,
Igor
-
November 2nd, 2011, 04:40 AM
#5
Re: TCHAR '\' use, adds space
Yes Im trying to continue my code next line.
Igor your method worked.
◄◄ hypheni ►►
-
November 2nd, 2011, 05:37 AM
#6
Re: TCHAR '\' use, adds space
 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.
Of course, that way you have to write.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|