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.66.246.136 with SMTP id xw8mr1696123pac.42.1453205060478; Tue, 19 Jan 2016 04:04:20 -0800 (PST) X-Received: by 10.182.19.129 with SMTP id f1mr336327obe.20.1453205060439; Tue, 19 Jan 2016 04:04:20 -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!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!o2no4413863iga.0!news-out.google.com!l1ni768igd.0!nntp.google.com!h5no6648141igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 19 Jan 2016 04:04:20 -0800 (PST) In-Reply-To: <77e47c8b-7dcc-4e86-8f89-1f348cdf08dd@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.150.168.79; posting-account=zd4fUAoAAABZGnAfDxrdJ5Lpts-qUilv NNTP-Posting-Host: 194.150.168.79 References: <77e47c8b-7dcc-4e86-8f89-1f348cdf08dd@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8aedb2f3-ec99-4cc5-943f-af7b4af39ed4@googlegroups.com> Subject: Re: Re-write a file in Ada From: comicfanzine@gmail.com Injection-Date: Tue, 19 Jan 2016 12:04:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29160 Date: 2016-01-19T04:04:20-08:00 List-Id: It compile now . At launching , there is empty lines in the test_file , instead of the this_file'lines . Am i missing something ? WITH Ada.Text_IO.Unbounded_IO ; USE Ada.Text_IO.Unbounded_IO ; WITH Ada.Strings.Unbounded ; USE Ada.Strings.Unbounded ; WITH Ada.Text_IO ; USE Ada.Text_IO ; Procedure count_nb_lines is this_file , test_file : File_type ; count : integer := 0 ; Begin Open (File => this_file , Mode => In_file , Name => "count_nb_lines.adb"); loop exit when End_Of_File( this_file ); skip_line( this_file ); count := count + 1 ; end loop ; Open (File => test_file , Mode => Out_file , Name => "test.adb"); declare Type Tableau_lines_file is array( 1 .. count) of Unbounded_String; case_array : Tableau_lines_file ; begin Loop exit when End_Of_File( this_file ); for i in 1..count loop case_array(i) := get_line(this_file); end loop ; End loop; for j in 1..count loop put_line( test_file , case_array(j) ); end loop; end; End count_nb_lines ;