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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.169.130 with SMTP id f2mr27074671ioj.10.1453180268665; Mon, 18 Jan 2016 21:11:08 -0800 (PST) X-Received: by 10.182.19.129 with SMTP id f1mr320214obe.20.1453180268642; Mon, 18 Jan 2016 21:11:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!o2no4343870iga.0!news-out.google.com!l1ni482igd.0!nntp.google.com!h5no6535975igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 18 Jan 2016 21:11:08 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.22.126.119; posting-account=zd4fUAoAAABZGnAfDxrdJ5Lpts-qUilv NNTP-Posting-Host: 195.22.126.119 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <687cd6fa-bf75-4892-b74e-d3ad381d8612@googlegroups.com> Subject: End of a file From: comicfanzine@gmail.com Injection-Date: Tue, 19 Jan 2016 05:11:08 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29154 Date: 2016-01-18T21:11:08-08:00 List-Id: When the program is launched , it count a excess line . And that's not a editor problem , the result is the same with severals . So , there is 30 lines in this source code file . However , the program count 31 . Why ? WITH Ada.Text_IO ; USE Ada.Text_IO ; Procedure count_nb_lines is this_file : File_type ; Last_line : Positive_Count := 1 ; Begin Open (File => this_file , Mode => In_file , Name => "count_nb_lines.adb"); loop set_line( this_file , Last_line ); Last_line := Last_line + 1 ; end loop ; exception when End_Error => null; put_line ( "End of this file ? : "&Boolean'image( End_Of_File( this_file ) ) ); put ( "Total of lines by Ada.Text_IO' s package : "&Positive_Count'Image( Last_line ) ); Close( this_file ); end count_nb_lines ;