From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c689b55786a9f2bd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: for S'Image use Func?? Date: Tue, 11 May 2010 10:34:42 +0300 Organization: Tidorum Ltd Message-ID: <84sfkjF3btU1@mid.individual.net> References: <4be417b4$0$6992$9b4e6d93@newsspool4.arcor-online.net> <1qcb6z4i20dyb.1dz2hd4c0vx69.dlg@40tude.net> <84r4k5Ftk8U1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 5IAHjEejmIoteBERvfLdCgpmXYhBo+YzNJPXv+rWy/6P6GldKP Cancel-Lock: sha1:3VqZMkb+dcEBVT5Fvb52dV/2klA= User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:11479 Date: 2010-05-11T10:34:42+03:00 List-Id: Warren wrote: > Niklas Holsti expounded in news:84r4k5Ftk8U1@mid.individual.net: >> ... if you read character by character, use the function >> Text_IO.End_Of_Line to detect the end of an input line. This works >> the same way in all systems, whatever line termination character >> (sequence), if any, is used. Follow with Skip_Line to go to the start >> of the next line. > > I assume that is true before you read the next "char". If I > then Skip_Line as you say, will I also get End_Of_Line true > if the next line is empty (null)? Yes, with one problem, which is that it is hard (that is, I don't know how) to detect when the very last line in the input file is null. This is because End_Of_Line returns true also at end of file, and End_Of_File returns true also when the data remaining in the file is an end-of-line (and end-of-page) before the true end of file. One consequence is that a truly empty file (like /dev/null) looks the same as a file with one null line (like echo ""). Try this program on a file with some empty lines: with Ada.Text_IO; use Ada.Text_IO; procedure Linelen is K : Character; Len : Natural; begin while not End_Of_File loop Len := 0; while not End_Of_Line loop Get (K); Len := Len + 1; end loop; Put_Line ( "Line" & Count'Image (Line) & " has" & Natural'Image (Len) & " characters."); Skip_Line; end loop; end Linelen; -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .