Skip to content

Commit b786ba9

Browse files
committed
add t250117-file-read
1 parent 3b6a5e6 commit b786ba9

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ members = [
3838
"t250114-simple-web",
3939
"t250115-simple-web-with-tokio",
4040
"t250116-simple-web-multi-thread",
41+
"t250117-file-read",
4142
]

t250117-file-read/Cargo.toml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "t250117-file-read"
3+
version.workspace = true
4+
authors.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
readme.workspace = true
8+
description.workspace = true
9+
keywords.workspace = true
10+
categories.workspace = true
11+
homepage.workspace = true
12+
repository.workspace = true
13+
14+
[dependencies]

t250117-file-read/src/main.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// use std::fs::File;
2+
// use std::io::{self, Read};
3+
4+
// fn main() -> io::Result<()> {
5+
// let mut file = File::open("README.md")?;
6+
// let mut contents = String::new();
7+
// file.read_to_string(&mut contents)?;
8+
// println!("{}", contents);
9+
// Ok(())
10+
// }
11+
12+
use std::fs;
13+
14+
fn main() -> Result<(), std::io::Error> {
15+
let contents = fs::read_to_string("README.md")?;
16+
println!("{}", contents);
17+
Ok(())
18+
}

0 commit comments

Comments
 (0)