Hi guys, I'm new to rust and for my first project, created a Brainfuck interpreter.
I tried to read a file and parse it.
let args: Vec<String> = env::args().collect(); let path = Path::new(&args[0]); let mut file = File::open(&path).expect("FILE NOT FOUND"); let mut file_content = String::new(); match file.read_to_string(&mut file_content) { Err(why)=>panic!("{}",why), Ok(_)=>print!("{}",file_content), } ;
But I get this error :
stream did not contain valid UTF-8
My file contains valid utf 8 but I still get that error.
how can I fix this error? thanks
================
Sorry guys, it's my fault. I must get the args[1]
for input file name.
cargo run -- bf