update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
11
Task/File-IO/Aime/file-io.aime
Normal file
11
Task/File-IO/Aime/file-io.aime
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
file i, o;
|
||||
text s;
|
||||
|
||||
f_open(i, "input.txt", OPEN_READONLY, 0);
|
||||
f_open(o, "output.txt", OPEN_CREATE | OPEN_TRUNCATE | OPEN_WRITEONLY,
|
||||
0644);
|
||||
|
||||
while (f_line(i, s) ^ -1) {
|
||||
f_text(o, s);
|
||||
f_byte(o, '\n');
|
||||
}
|
||||
|
|
@ -1 +1,7 @@
|
|||
file:copy("input.txt","output.txt").
|
||||
-module( file_io ).
|
||||
|
||||
-export( [task/0] ).
|
||||
|
||||
task() ->
|
||||
{ok, Contents} = file:read_file( "input.txt" ),
|
||||
ok = file:write_file( "output.txt", Contents ).
|
||||
|
|
|
|||
13
Task/File-IO/Racket/file-io.rkt
Normal file
13
Task/File-IO/Racket/file-io.rkt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#lang racket
|
||||
(define file-content
|
||||
(with-input-from-file "input.txt"
|
||||
(lambda ()
|
||||
(let loop ((lst null))
|
||||
(define new (read-char))
|
||||
(if (eof-object? new)
|
||||
(apply string lst)
|
||||
(loop (append lst (list new))))))))
|
||||
|
||||
(with-output-to-file "output.txt"
|
||||
(lambda ()
|
||||
(write file-content)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue