Well, I am very new at c++, so I decided to do something simple after a few projects that gave me a basic understanding of c++ (no, the hello world one doesn’t count), I just want to make a folder on %appdata% and I figured out I just needed to do this
void MakeFolder()
{
LPCTSTR appdata = getenv("APPDATA");
char *appchar = getenv("APPDATA");
size_t sizeApp = sizeof(appchar) + 8;
LPCTSTR folder = "/Folder";
StringCchCat(appdata, sizeApp, folder);
CreateDirectory (appdata,NULL);
}
But it says “StringCchCat: identifier not found”, I have included STDDEF.h already, and the error code doesn’t change! but I am not sure the code itself would work anyway…
StringCchCatis declared in<strsafe.h>; you need to include that header.But… since you are new to C++, don’t mess with C strings. Use
std::string: