Hands-on System Tooling
Let's build a simple version of the Linux cat command. It will take a filename as an argument and print its content.
rust use std::env; use std::fs;
fn main() { let args: Vec<String> = env::args().collect(); let filename = &args[1]; let content = fs::read_to_string(filename).expect("Could not read file"); println!("{content}"); }
In this project, we learn about file I/O and handling basic errors with expect.