/tutorial/io/redirection_example.e
http://github.com/tybor/Liberty · Specman e · 29 lines · 23 code · 3 blank · 3 comment · 1 complexity · 86f7bdc20c51fa687976b56d2a8559f1 MD5 · raw file
- class REDIRECTION_EXAMPLE
- --
- -- Shows how to redirect `std_input_stream', `std_output_stream' and `std_error_stream'.
- --
- create {ANY}
- make
- feature {}
- make
- local
- log_name: STRING; log_file: TEXT_FILE_WRITE
- do
- log_name := "redirection_example.log"
- io.put_string("Output redirected on %"" + log_name + "%".%N")
- create log_file.connect_to(log_name)
- if log_file.is_connected then
- standard_streams.set_std_output(log_file)
- standard_streams.std_output.put_string("This is not on the screen!%N")
- log_file.put_string("This is not on the screen!%N")
- standard_streams.restore_std_output
- log_file.disconnect
- standard_streams.std_output.put_string("Do not forget to remove the %"" + log_name + "%" file.%N")
- else
- std_output.put_string("Cannot write %"" + log_name + "%" in the current working directory.%N")
- end
- end
- end -- class REDIRECTION_EXAMPLE