Stream I/O
This page is under construction. Please come back later.
/****************************************************************************** * This program simply copies an input stream to the console character by * character like the Unix 'cat' program. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ fn main() { let mut c:i32 = 0; while getcodepoint(c) { putcodepoint(c); } }
Output
$ rustc StreamIO1.rs
error[E0425]: cannot find function `getcodepoint` in this scope
--> StreamIO1.rs:10:8
|
10 | while getcodepoint(c) {
| ^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `putcodepoint` in this scope
--> StreamIO1.rs:11:3
|
11 | putcodepoint(c);
| ^^^^^^^^^^^^ not found in this scope
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc StreamIO1.rs
error[E0425]: cannot find function `getcodepoint` in this scope
--> StreamIO1.rs:10:8
|
10 | while getcodepoint(c) {
| ^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `putcodepoint` in this scope
--> StreamIO1.rs:11:3
|
11 | putcodepoint(c);
| ^^^^^^^^^^^^ not found in this scope
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0425`.
/****************************************************************************** * This program simply copies an input stream to the console line by line. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ fn main() { let mut line:&str = ""; while getline(line) { println!("{}", line); } }
Output
$ rustc StreamIO2.rs
error[E0425]: cannot find function `getline` in this scope
--> StreamIO2.rs:9:8
|
9 | while getline(line) {
| ^^^^^^^ not found in this scope
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
$ rustc StreamIO2.rs
error[E0425]: cannot find function `getline` in this scope
--> StreamIO2.rs:9:8
|
9 | while getline(line) {
| ^^^^^^^ not found in this scope
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
/****************************************************************************** * This program reads bytes from STDIN and prints them in decimal format. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ mod utils; fn main() { binmode(cin); let mut c:u8 = 0; let mut count:isize = 0; while getbyte(c) { print!("{} ", c); count += 1; if count % 20 == 0 { println!(""); } } if count % 20 != 0 { println!(""); } }
Output
$ rustc StreamIO3.rs
error[E0425]: cannot find value `cin` in this scope
--> StreamIO3.rs:10:10
|
10 | binmode(cin);
| ^^^ not found in this scope
error[E0425]: cannot find function `binmode` in this scope
--> StreamIO3.rs:10:2
|
10 | binmode(cin);
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `getbyte` in this scope
--> StreamIO3.rs:13:8
|
13 | while getbyte(c) {
| ^^^^^^^ not found in this scope
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc StreamIO3.rs
error[E0425]: cannot find value `cin` in this scope
--> StreamIO3.rs:10:10
|
10 | binmode(cin);
| ^^^ not found in this scope
error[E0425]: cannot find function `binmode` in this scope
--> StreamIO3.rs:10:2
|
10 | binmode(cin);
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `getbyte` in this scope
--> StreamIO3.rs:13:8
|
13 | while getbyte(c) {
| ^^^^^^^ not found in this scope
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0425`.
Questions
- {{Who's on first?}}
- {{Who's on second?}}
- {{Who's on third?}}
Projects
More ★'s indicate higher difficulty level.
- Alphabetic Only Filter
- Average Filter
- Caesar Cipher
- Caesar Cipher (Modified)
- Frequency Table (Bytes)
- Frequency Table (Characters)
- Head and Tail
- Hexadecimal Filter
- Hexadecimal Filter with Byte Count
- Hexadecimal Filter (Unicode)
- Histogram
- Line Number Filter
- Lowercase Filter
- Median Filter
- Punchcard Filter
- Random Bytes
- Random Characters
- Simple 8-Bit Checksum
- Simple 32-Bit Checksum
- Standard Deviation
- Total Filter (Floating Point)
- Total Filter (Integer)
- Uppercase Filter
- Vigenère Cipher
- XML Encoding Filter
References
- [[Rust Language Reference]]
- [[Rust Compiler]]