Sign in to follow this  
jajce85

newline character not recognised by visual studio

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
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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this