/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
- class READ_LINE
- -- This example show how to use read_line.
- -- The reading pattern is different from the one used with read_character.
- -- It HAS to be different.
- create {ANY}
- make
- feature {}
- make is
- local
- tfr: TEXT_FILE_READ
- do
- from
- create tfr.connect_to("read_line.e")
- until
- tfr.end_of_input
- loop
- tfr.read_line
- if tfr.end_of_input then
- -- The last line of the file does not end with a new
- -- line character. Remove this test if you don't care.
- std_output.put_string(tfr.last_string)
- else
- std_output.put_line(tfr.last_string)
- end
- end
- tfr.disconnect
- end
- -- NOTE: last_string always returns the same STRING object, it's up
- -- to you to make a copy if you need to keep the string value.
- end