October 2019
Intermediate to advanced
444 pages
10h 37m
English
We can read files from disk in just a few steps:
use std::fs::{self, File};use std::io::{self, BufRead, BufReader, BufWriter, Read, Seek, Write};use std::path::Path;const TEST_FILE_NAME: &str = "lorem.txt";
fn read() -> io::Result<()> { let path = Path::new(TEST_FILE_NAME); let input = File::open(path)?; let buffered = BufReader::new(input); let words: Vec<usize> = buffered .lines() .map(|line| line.unwrap().split_ascii_whitespace().count()) ...Read now
Unlock full access