comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: Latin_1 and portability
Date: 10 Dec 2003 22:52:32 +0100
Date: 2003-12-10T22:52:32+01:00	[thread overview]
Message-ID: <m3d6awtk67.fsf@insalien.org> (raw)
In-Reply-To: uk7545pc0.fsf@wanadoo.fr

Pascal Obry <p.obry@wanadoo.fr> writes:

> xavier.serrand@free.fr (Xavier Serrand) writes:
> 
> > For return (or enter)
> > 
> > when using Text_Io.Get_Immediate (E);
> > 
> > on UNIX or Linux Suse Character'Pos (E) = 10
> > on Windows 2000 Character'Pos (E) = 13
> 
> On Windows you should get 13+10 (CRLF) on UNIX only 10 (LF). You
> could try to skip the 13 and call Get_Immediate a second time in
> this case.

Just in case you're new to computers: CR stands for Carriage Return
and LF stands for Line Feed.  These are instructions for the cursor of
the terminal or the printing head of a teletype or printer, and are
encoded in ASCII as 13 and 10 respectively (in decimal; in hex they
are 0D and 0A respectively).  CR causes the cursor to go the the left
of the page, LF causes it to go down one line.

By convention, text files (and the terminal) on Windows use a sequence
of CR and LF to signal the end of a line.  Unices and GNU/Linux use a
different convention with only LF.  That is why Pascal's advice of
just ignoring the CR should get you going.  However, others have
pointed at function Text_IO.End_Of_Line, which does this for you in a
more portable way not relying on particular ASCII codes.

-- 
Ludovic Brenta.



  reply	other threads:[~2003-12-10 21:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 12:15 Latin_1 and portability Xavier Serrand
2003-12-10 13:45 ` Georg Bauhaus
2003-12-10 22:00   ` Xavier Serrand
2003-12-10 18:33 ` Jeffrey Carter
2003-12-10 21:34 ` Pascal Obry
2003-12-10 21:52   ` Ludovic Brenta [this message]
2003-12-11  3:40 ` Robert I. Eachus
2003-12-12 23:41   ` Larry Kilgallen
2003-12-13 14:48     ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
2003-12-10 13:16 amado.alves
2003-12-13  2:27 amado.alves
2003-12-13 13:09 ` Larry Kilgallen
2003-12-13 13:35 amado.alves
2003-12-13 14:54 ` Björn Persson
2003-12-13 22:17   ` Larry Kilgallen
2003-12-14  1:55     ` Björn Persson
2003-12-13 22:21 ` Larry Kilgallen
2003-12-13 15:24 amado.alves
2003-12-14  2:46 ` Björn Persson
2003-12-14  5:04   ` Jeff C,
2003-12-14  6:12     ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox