Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ \n\r

\n\r

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ithildin   USA  (262 posts)  Bio
Date Sat 27 Mar 2004 04:39 PM (UTC)
Message
i know this adds a return, but what does the n and r stand for. also. is there a way to take away a return...like a negative return. instead of adding a new line, could you take a way a line? just tryin to brush up on this stuff you guys call coding ;)

Thanks,
Ithildin
Top

Posted by Ithildin   USA  (262 posts)  Bio
Date Reply #1 on Sat 27 Mar 2004 05:06 PM (UTC)

Amended on Sat 27 Mar 2004 05:07 PM (UTC) by Ithildin

Message
ok, found out that \n = new line
and \r = Carriage return.

for all you guys out there who wants to know.

Escape Sequences
Character combinations consisting of a backslash (\) 
followed by a letter or by a combination of digits 
are called “escape sequences.” To represent a newline character, single quotation mark, or certain other 
characters in a character constant, you must use 
escape sequences. An escape sequence is regarded as 
a single character and is therefore valid as a character constant. 

Escape sequences are typically used to specify actions 
such as carriage returns and tab movements on terminals 
and printers. They are also used to provide 
literal representations of nonprinting characters 
and characters that usually have special meanings, 
such as the double quotation mark ("). Table 1.4 
lists the ANSI escape sequences and what they represent.

Note that the question mark preceded by a 
backslash (\?) specifies a literal question mark 
in cases where the character sequence would be 
misinterpreted as a trigraph. See Trigraphs for 
more information.

Table 1.4   Escape Sequences

Escape Sequence Represents 
\a Bell (alert) 
\b Backspace 
\f Formfeed 
\n New line 
\r Carriage return 
\t Horizontal tab 
\v Vertical tab 
\' Single quotation mark 
\"  Double quotation mark 
\ Backslash 
\? Literal question mark 
\ooo ASCII character in octal notation 
\xhhh ASCII character in hexadecimal notation 




i'm wondering if \b would work..but i'll check it out later. any other comments are welcome.

Top

Posted by Necromancer   Hungary  (3 posts)  Bio
Date Reply #2 on Sat 27 Mar 2004 06:06 PM (UTC)
Message
Hmmm, I don't think it will work...
I made a little program in C, its code:
#include <stdio.h>
#include <conio.h>
main()
{
	int i;
	printf("Line 1.\n\rLine 2.\n\rLine 3.\n\rPress ENTER to continue!");
	getch();
	for(i=1;i<45;i++)
		printf ("\b");
	printf("Line rewritten.");
}


So it have to do it:
Line 1.
Line 2.
Line 3.
Press ENTER to continue!

End if we'll press any key, it have to write:
Line rewritten.
Line 2.
Line 3.


But it wrote only:
Line 1.
Line 2.
Line 3.
Line rewritten.continue!


So, the \b is usable to get back in a line, but isn't to get back whole lines.
But try it, maybe only my compiler is bad. (I've used Digital Mars)
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 31 Mar 2004 06:04 AM (UTC)
Message
Backspace would generally be used when processing typing. It is a bit unusual for a server to send stuff to a client and then try to "take it back" with backspaces.

The client might support it, many wouldn't.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,727 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.