Created
April 20, 2024 02:28
-
-
Save sebastian-navarro/258f9388cea36c00cc9ecc39700de036 to your computer and use it in GitHub Desktop.
Read file in Rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs; | |
use std::io; | |
fn main() -> io::Result<()> { | |
let file_contents = fs::read_to_string("info.txt")?; | |
println!("info.txt content =\n{file_contents}"); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment