print file content
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -1,3 +1,23 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::{stdin, stdout, BufReader, Read};
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let file_name = match env::args().nth(1){
|
||||
None => {
|
||||
println!("Usage: rbfckr <filename>");
|
||||
return;
|
||||
}
|
||||
Some(file_name) => file_name,
|
||||
};
|
||||
|
||||
let bf_code = match fs::read_to_string(file_name) {
|
||||
Ok(bf_code) => bf_code,
|
||||
Err(e) => {
|
||||
println!("Error reading file: {}", e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
println!("{}", bf_code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user