Back to course

Systems: Command Line Arguments

Rust for Systems & Web3 Security

Interacting with the OS

To build tools like ls or cat, we need to read user input from the terminal. We use std::env::args.

rust use std::env;

fn main() { let args: Vec = env::args().collect(); println!("{:?}", args); }

Note that the first argument is always the path to the executable itself.