mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 23:02:28 +01:00
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2364 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
53 lines
988 B
Plaintext
53 lines
988 B
Plaintext
[[Property:title|Example: File IO]]
|
|
[[Property:weight|0]]
|
|
[[Property:uuid|b26aa8e3-5963-94ae-b523-642c8b79637b]]
|
|
==Description==
|
|
|
|
Create a file "output.txt" containing the contents of "input.txt".
|
|
|
|
|
|
==Source==
|
|
|
|
Problem description from [http://rosettacode.org/wiki/File_IO Rosetta Code: File IO]
|
|
|
|
==Solution==
|
|
|
|
<code>
|
|
class
|
|
APPLICATION
|
|
|
|
create
|
|
make
|
|
|
|
feature {NONE} -- Initialization
|
|
|
|
make
|
|
-- Run application.
|
|
do
|
|
create input_file.make_open_read ("input.txt")
|
|
create output_file.make_open_write ("output.txt")
|
|
|
|
from
|
|
input_file.read_character
|
|
until
|
|
input_file.exhausted
|
|
loop
|
|
output_file.put (input_file.last_character)
|
|
input_file.read_character
|
|
end
|
|
|
|
input_file.close
|
|
output_file.close
|
|
end
|
|
|
|
feature -- Access
|
|
|
|
input_file: PLAIN_TEXT_FILE
|
|
output_file: PLAIN_TEXT_FILE
|
|
|
|
end
|
|
</code>
|
|
|
|
|
|
|