Created
December 3, 2025 20:28
-
-
Save eakst7/3587cc67b3f8d648362a0b63f60e216f to your computer and use it in GitHub Desktop.
Read a file line by line in Rust
This file contains hidden or 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
| fn main() { | |
| let f = BufReader::new(File::open("text").unwrap()); | |
| for s in f.lines().map(|x| x.unwrap()) { | |
| println!("{}", s); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment