Created
January 20, 2024 22:15
-
-
Save plus7/43edaebb2b84dc8535f566cc6bbeeec5 to your computer and use it in GitHub Desktop.
テキストファイル処理のテンプレ
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::File; | |
use std::io::{BufRead, BufReader}; | |
fn main() { | |
let file = match File::open("test.txt") { | |
Err(why) => panic!("couldn't open {}: {}", "test.txt", why), | |
Ok(file) => file, | |
}; | |
for result in BufReader::new(file).lines() { | |
let l = result.unwrap(); | |
println!("{}", l); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment