Not sure what are the expected behaviours for these handle modes are "r" | "w" | "x" | "a" | "r+" | "w+" | "x+" | "a+", but if this is based on C std::fopen then using "w" should create the file if it doesn't exist. Right now it throws a no such file or directory error.