fix #381 by foryoung365 · Pull Request #382 · cppcheck-opensource/simplecpp
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution still has flaws; when the file does not exist, an empty file will be created. Therefore, I replaced it with
std::fstream fs(simplePath, std::ios::in|std::ios::out);
Here is a simple test result (linux, mac, and windows):
https://github.com/foryoung365/CppFstreamTest/actions/runs/11549258974
Here are some references:
https://en.cppreference.com/w/cpp/io/basic_filebuf/open