直接上代码吧:
use std::io::Read;fn main() {let mut file = std::fs::File::open("data.txt").unwrap();let mut contents = String::new();file.read_to_string(&mut contents).unwrap();// print!("{}", contents);for s in contents.lines() {print!("->{}<-\n", s);}
}
直接上代码吧:
use std::io::Read;fn main() {let mut file = std::fs::File::open("data.txt").unwrap();let mut contents = String::new();file.read_to_string(&mut contents).unwrap();// print!("{}", contents);for s in contents.lines() {print!("->{}<-\n", s);}
}