comp.lang.ada
 help / color / mirror / Atom feed
From: comicfanzine@gmail.com
Subject: Re: End of a file
Date: Tue, 19 Jan 2016 00:43:08 -0800 (PST)
Date: 2016-01-19T00:43:08-08:00	[thread overview]
Message-ID: <2fa0ebeb-967d-4f50-8634-2462904a920e@googlegroups.com> (raw)
In-Reply-To: <687cd6fa-bf75-4892-b74e-d3ad381d8612@googlegroups.com>

>How many lines do you wish this call to skip on
>each iteration? 

Edit : Sorry , i posted the wrong code .

It just doesn't make sense , why the program create a extra line ?

The rignt number is 25 lines .

But it print 26 .

WITH Ada.Text_IO ;  USE Ada.Text_IO ;

Procedure count_nb_lines is

  this_file : File_type ;

  count : Positive_Count := 1 ;

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 ;

   put ( "Total of lines by Ada.Text_IO' s package : "&Positive_Count'Image( count ) );

   Close( this_file );

end count_nb_lines ;


  parent reply	other threads:[~2016-01-19  8:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  5:11 End of a file comicfanzine
2016-01-19  5:52 ` J-P. Rosen
2016-01-19  7:20 ` comicfanzine
2016-01-19  8:02   ` Georg Bauhaus
2016-01-19  8:43 ` comicfanzine [this message]
2016-01-19  8:44   ` MM
2016-01-20  1:16 ` comicfanzine
replies disabled

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