comp.lang.ada
 help / color / mirror / Atom feed
* End of a file
@ 2016-01-19  5:11 comicfanzine
  2016-01-19  5:52 ` J-P. Rosen
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: comicfanzine @ 2016-01-19  5:11 UTC (permalink / raw)


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 ;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-20  1:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-01-19  8:44   ` MM
2016-01-20  1:16 ` comicfanzine

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