Menu

[r244]: / trunk / demos / Source / numeric_8-get_line.ada  Maximize  Restore  History

Download this file

37 lines (30 with data), 989 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- {{Ada/Sourceforge|numeric_8-get_line.adb}}
separate (Numeric_8)
function Get_Line return Str.Unbounded_String is
use type Str.Unbounded_String;
BufferSize : constant Natural := 2000;
Retval : Str.Unbounded_String :=
Str.Null_Unbounded_String;
Item : String (1 .. BufferSize);
Last : Natural;
begin
Get_Whole_Line : loop
T_IO.Get_Line (Item => Item, Last => Last);
Str.Append
(Source => Retval,
New_Item => Item (1 .. Last));
exit Get_Whole_Line when Last < Item'Last;
end loop Get_Whole_Line;
return Retval;
end Get_Line;
----------------------------------------------------------------------------
-- $Author$
--
-- $Revision$
-- $Date$
--
-- $Id$
-- $HeadURL$
----------------------------------------------------------------------------
-- vim: textwidth=0 nowrap tabstop=8 shiftwidth=3 softtabstop=3 expandtab
-- vim: filetype=ada encoding=utf-8 fileformat=unix foldmethod=indent