Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie in MFC - ctsring ... 1

Status
Not open for further replies.

rezzij

Instructor
Mar 30, 2004
48
US
How do I insert a carriage return in a CString that is displayed in an edit box ? \n works fine in a MessageBox, not in this ...

thanks
 
...oh, and the edit box must be set as multiline of course.

/Per
[sub]
www.perfnurt.se[/sub]
 
thanks a ton - works! but what is it ??
 
For some weird reason Microsoft decided that using a single char for new-line isn't enough and thought that it'd be best to use two: \r\n.

\r - Carriage return.
\n - Line feed.

The funny thing is that not everyone expect \r\n at all times, some does it, some handles single \r (and ignore the \n) others just handle the \n (and ignore \r).

Consequently, in some applications \r works, in some \n and in some full \r\n is required.

All this confusion is mainly a good thing because as a programmer the more complicated stuff are, the more work I have. And the more work I have the more the chances are of getting a salary even the next month.


/Per
[sub]
www.perfnurt.se[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top