I am currently programming a patching application for my game. As i am used to program with Java its hard for me to get along with C++, the patcher has to be wridden in C++ unfortunately, in Java i could do this in 5 minutes but a new language. . . not so much.
This is my current Code to create the folders i need:
#include <windows.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
//Set the Strings the Patcher needs.
string DNGDirectory = "C:\\dnGames";
const char* DDDirectory = "C:\\dnGames\\DuelistsDance";
//Create directories if they don't exist yet.
if (CreateDirectory(DNGDirectory.c_str(), NULL) || ERROR_ALREADY_EXISTS == GetLastError())
{
if (CreateDirectory(DDDirectory.c_str(), NULL) || ERROR_ALREADY_EXISTS == GetLastError())
{
cout << "Directories successfully created." << std::endl;
}
}
return 0;
}
One time i use string for the variable, because this was in the example code i picked out from Google (Create a directory if it doesn't exist), but i get the error "Das Argument vom Typ ""const char "" ist mit dem Parameter vom Typ ""LPCWSTR"" inkompatibel." (Should be the argument of type ""const char" is incompatible with the parameter of type ""LPCWSTR"" in english) I tried to fix it by using "const char*" as type, but this gets me the error "Der Ausdruck muss einen Klassentyp aufweisen." (They expression must have a class type). Does anyone know how to fix this? I am using Visual Studio 2019 for this.