Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2009 11:22:11 +0200
From:      Bertram Scharpf <lists@bertram-scharpf.de>
To:        freebsd-questions@freebsd.org
Subject:   Re: what character is a physical newline
Message-ID:  <20090629092211.GB26781@marge.bs.l>
In-Reply-To: <4A4826A5.6020506@gmail.com>
References:  <4A48252C.1090808@gmail.com> <4ad871310906281926i54fdac53u1d4681c8060e4d36@mail.gmail.com> <4A4826A5.6020506@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Am Sonntag, 28. Jun 2009, 22:27:49 -0400 schrieb Aryeh M. Friedman:
> Glen Barber wrote:
>> On Sun, Jun 28, 2009 at 10:21 PM, Aryeh M.
>> Friedman<aryeh.friedman@gmail.com> wrote:
>>   
>>> I am writting a parser (tokenizes all characters among other things) and
>>> need to know what control char is equivelent to a newline (I do not need
>>> windows cross compatibility)
>>
>> What do you mean exactly?  What language(s)?  If I understand your
>> question correctly, the C / C++ / Java / PHP (and I think Perl)
>> 'newline' character is '\n'
>>   
> I meant what ascii character does \n actual correspond to (I assume <CR> 
> but just making sure)

  $ perl -e 'print ord("\n"), "\n"'
  10
  $ python -c 'print ord("\n")'
  10
  $ ruby -e 'puts "\n"[0]'
  10
  $ cat nl.c 
  #include "stdio.h"
  int main(int argc, char **argv)
  {
      printf( "%d\n", '\n');
      return 0;
  }
  $ cc -o nl nl.c
  $ ./nl
  10
  $ echo | od -d
  0000000    10
  0000001


Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090629092211.GB26781>