This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View 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');
}

View file

@ -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 ).

View 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)))