Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-06-2008, 04:52 PM   #1 (permalink)
Bigzz
Recruit
 
Join Date: Aug 2008
Posts: 1
Bigzz is on a distinguished road
\n \r \t

\n \r \t

Does anyone know what the hell this does? I can't figure it out.\
Thanks
Bigzz is offline   Reply With Quote
Old 08-07-2008, 08:16 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
<new line> <carrige return> <tab>
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-07-2008, 02:25 PM   #3 (permalink)
waveclaw
Recruit
 
waveclaw's Avatar
 
Join Date: Jul 2006
Location: USA
Posts: 19
waveclaw is on a distinguished road
Send a message via ICQ to waveclaw Send a message via AIM to waveclaw Send a message via MSN to waveclaw Send a message via Yahoo to waveclaw
Escape Codes

An escape code is one that uses a special character to change the meaning of other characters (aka a contex-sensitive code.) Usually the escape character, backslash in your case, is one of the normal characters. To replicate the escape code's normal character, you escape the escape code. For your example: \\ to get a normal backslash.

You are probably talking about the escape code used to format C and C++ strings used with printf for program output. See printf for a good reference. Also, some Tips on printf contains a handy Special Character table of printf escape codes.

Normally \n and \r are newline and carriage return. With a typewriter printer, both characters are needed to end a line of text. The newline would advance the paper 1 line and the carriage return moved the print head to the first column. Character-oriented file systems like those on Microsoft, Apple and Unix operating systems tend to use either one (\n for Unix, \r for Apple) or both (\n\r on Microsoft DOS and Windows) to indicate the end of a line in a plain text file.

Conversion is usually needed to make such plain text files usable once copied between file systems with different codes (e.g. with recode, dos2unix or unix2dos.) When this conversion is carried out on binary files, this usually destroys the content as binary files usually don't have normal lines of text. Not only would lines not be delimited by \n or \r but also a line (record) in a binary file could be the length of the whole file with \n and \r standing in for special codes for the program that reads the binary file.

Similar codes are used for command line interfaces (CLIs) such as the bash and other shells. The can include the \t tab code and the \v vertical tab code.

The '\' escape code is far from the only one in common use. See the ASCII Table of ANSI Escape Codes for DOS (cmd.exe) and some Unix or Linux terminals.
waveclaw is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 12:44 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting