• Advertisement
Sign in to follow this  

newline character not recognised by visual studio

This topic is 2908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, in Visual Studio 2008 whenever I add a newline character to a character array, say for example: char* c= "abc\n"; the newline at the end always gets read as an unknown value (square text visualizer i.e. "abc[]"). It this a unicode problem maybe?, because I am compiling using multi-byte character set. Thanks [Edited by - jajce85 on March 6, 2010 3:58:22 AM]

Share this post


Link to post
Share on other sites
Advertisement
Where are you seeing it as a square? If you're looking at it in the watch window, that's because the watch window is only a single line, so it'll show it as a non-printable character.

Share this post


Link to post
Share on other sites
On windows \n isn't a line terminator lines are terminated by \r\n. Depending on where you are putting the \n it might work and it might not.

Share this post


Link to post
Share on other sites
Quote:
Original post by stonemetal
On windows \n isn't a line terminator lines are terminated by \r\n. Depending on where you are putting the \n it might work and it might not.


That answer is too generic. On Windows, except when dealing with files in binary mode, '\n' is just that, '\n' ... a single character (or code point, if we're talking UNICODE). Feel free to correct me, anyone.

Share this post


Link to post
Share on other sites
When Iam in Visual Studio debug mode and hover over the character array variable. If I go to Text Visualizer the newline is a square

Share this post


Link to post
Share on other sites
Some of the displays in Visual Studio just show newline characters as squares. That's just the way it is. Don't worry about it, your newline character is in there alright. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement