Re: K&R2 2.3 : /n vs /r
From: Kurt Watzka (watzka_at_stat.uni-muenchen.de)
Date: 10/20/04
- Next message: Eric Sosman: "Re: GetByte(int x, int n)"
- Previous message: Christopher Benson-Manica: "Re: bignums.h"
- In reply to: john blackburn: "Re: K&R2 2.3 : /n vs /r"
- Next in thread: Mabden: "Re: K&R2 2.3 : /n vs /r"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 20 Oct 2004 18:06:06 +0200
john blackburn wrote:
> Merrill & Michele wrote:
>
>> Section 2.3 of K&R enumerates the complete set of escape sequences.
>>
>> Q1) Is it possible to ask the following question without getting into
>> implementation/platform talk?
>>
>> Q2) What on earth is the difference between newline and carriage return?
>>
>> MPJ
>
> '\r' is simply a carriage return whereas '\n' is a carriage return
> followed
> by line feed.
Well, from the persprective of this newsgroup, this is certainly wrong.
'\r' is a carriagge return, '\n' is a newline character. From a C
programmers point of view, '\n' is _the_ line separator.
> Note that a carriage return is simply that, it moves the
> cursor to the beginning of the current line and does not move on to the
> next line.
>
> It is here you have to be careful as UNIX text files are of a different
> format from Windows text files and need conversion when moving from one
> o/s to the other.
On a T200 teletype you had to be carefull to always use _two_ carriage
returns and a linefeed at 75 baud, because the time to move the carriage
from the leftmost position to the rightmost position took almost 1/25
of a second. With '\r\n' you would end up with the first character of
the new line in the middle of the line. However, this is about as relevant
to text file formats from a C programming point of view as the different
_physical_ representations of line separators used in different
environments.
Kurt Watzka
- Next message: Eric Sosman: "Re: GetByte(int x, int n)"
- Previous message: Christopher Benson-Manica: "Re: bignums.h"
- In reply to: john blackburn: "Re: K&R2 2.3 : /n vs /r"
- Next in thread: Mabden: "Re: K&R2 2.3 : /n vs /r"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|