Hi, I am getting an error when trying to specify a file path for my program.
It says "failed to open file for writing". I searched around google but couldn't find a solution. I know its a silly question but I did try... I tried the tips found here... https://stackoverflow.com/questions/8960087/how-to-convert-a-char-array-to-a-string
Using <windows.h> is non-standard and restricts your app to the MS ecosystem.
FYI, the SO topic you linked is over 12 years old, so is missing a lot of newer info the C++ stdlib has. Here's a quickie example snippet for using <filesystem> (need to specify C++17 or later):
1 2 3 4 5 6 7
#include<iostream>
#include <filesystem>
int main( )
{
std::filesystem::create_directories("C:\\newfolder\\morons");
}
There's an alternate way to specify subfolders on Windows. Instead of double backslashes use single forward slashes: "C:/newfolder/morons".
FYI, loadpng hasn't been updated since 2021. It is available via vcpkg, there are several other PNG libs available that have been been updated more recently. pngpp, libspng and libpng.
If you were using vcpkg (it's a package manager) you can integrate any downloaded libraries, MSBuild projects can now #include any headers from the installed libraries and linking is handled automatically. No need to manually change project settings, and installing new libraries make them instantly available.