Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
20
Task/File-IO/BASIC/file-io-2.basic
Normal file
20
Task/File-IO/BASIC/file-io-2.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
100 I$ = "INPUT.TXT"
|
||||
110 O$ = "OUTPUT.TXT"
|
||||
120 D$ = CHR$(4)
|
||||
130 M$ = CHR$(13)
|
||||
140 PRINT D$"VERIFY"I$
|
||||
150 PRINT D$"OPEN"O$M$D$"CLOSE"O$M$D$"DELETE"O$
|
||||
160 PRINT D$"OPEN"O$M$D$"OPEN"I$;
|
||||
|
||||
170 PRINT M$D$"READ"I$
|
||||
180 ONERR GOTO 250
|
||||
190 GET C$
|
||||
200 POKE 216,0
|
||||
210 PRINT M$D$"WRITE"O$",B"B
|
||||
220 IF C$ <> M$ THEN PRINT C$;
|
||||
230 B = B + 1
|
||||
240 GOTO 170
|
||||
|
||||
250 POKE 216,0
|
||||
260 IF PEEK(222) <> 5 THEN RESUME
|
||||
270 PRINT M$D$"CLOSE"I$M$D$"CLOSE"O$
|
||||
|
|
@ -1 +1,21 @@
|
|||
file_copy("input.txt","output.txt")
|
||||
var file, str;
|
||||
file = file_text_open_read("input.txt");
|
||||
str = "";
|
||||
while (true)
|
||||
{
|
||||
str += file_text_read_string(file);
|
||||
if (file_text_eof(file))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
str += chr(vk_enter);
|
||||
file_text_readln(file);
|
||||
}
|
||||
}
|
||||
file_text_close(file);
|
||||
|
||||
file = file_text_open_write("output.txt");
|
||||
file_text_write_string(file,str);
|
||||
file_text_close(file);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ public class Test {
|
|||
BufferedReader br = new BufferedReader(new FileReader("input.txt"));
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter("output.txt"));
|
||||
String line;
|
||||
while (line = br.readLine() != null) {
|
||||
while ((line = br.readLine()) != null) {
|
||||
bw.write(line);
|
||||
bw.newLine();
|
||||
}
|
||||
|
|
|
|||
20
Task/File-IO/Rust/file-io.rust
Normal file
20
Task/File-IO/Rust/file-io.rust
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
extern mod std;
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
let input_file = &Path("input.txt");
|
||||
let input = io::read_whole_file_str(input_file);
|
||||
match input {
|
||||
Err(e) => fail!(e),
|
||||
Ok(_) => {}
|
||||
}
|
||||
|
||||
let output_file = &Path("output.txt");
|
||||
let output = io::file_writer(output_file, [io::Create, io::Truncate]);
|
||||
match output {
|
||||
Err(e) => fail!(e),
|
||||
Ok(_) => {}
|
||||
}
|
||||
|
||||
output.unwrap().write_str(input.unwrap());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue