When I use File::open()
, I get the following error:
The filename, directory name, or volume label syntax is incorrect. (os error 123)
This is my code:
println!("enter an input file:");
match io::stdin().read_line(&mut input) {
Err(_) => {
println!("input error");
return;
}
_ => {}
}
let pinput = Path::new(&input);
match File::open(&pinput) {
Ok(mut finput) => {
// ...
}
Err(e) => println!("input file error: {}, {}", e, pinput.display()),
}
The file I am trying to open is C:/Users/Name/test.txt
where Name
is my name, the path contains no special characters or spaces, just members of the English alphabet.