PageRenderTime 27ms CodeModel.GetById 23ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/io/read_line.e

http://github.com/tybor/Liberty
Specman e | 35 lines | 23 code | 5 blank | 7 comment | 1 complexity | de02cfa616e0a22d3945d6e9e032716f MD5 | raw file
 1class READ_LINE
 2-- This example show how to use read_line.
 3-- The reading pattern is different from the one used with read_character.
 4-- It HAS to be different.
 5
 6create {ANY}
 7	make
 8
 9feature {}
10	make is
11		local
12			tfr: TEXT_FILE_READ
13		do
14			from
15				create tfr.connect_to("read_line.e")
16			until
17				tfr.end_of_input
18			loop
19				tfr.read_line
20				if tfr.end_of_input then
21					-- The last line of the file does not end with a new 
22					-- line character. Remove this test if you don't care.
23					std_output.put_string(tfr.last_string)
24				else
25					std_output.put_line(tfr.last_string)
26				end
27			end
28			tfr.disconnect
29		end
30
31	-- NOTE: last_string always returns the same STRING object, it's up 
32	-- to you to make a copy if you need to keep the string value.
33
34end
35