c++visual-studio-2010extractor

Making a Extracting/Compiling program in Visual C++ 2010 but have errors


I am building a .SM2 and .RM2 extractor/compiler for a game but I am having trouble with the code. I am not experienced in C++ at all and the code is source code given by the original creator. Even his original file that wasnt edited by me had errors but he still made the program. Can someone please help me with the errors?

Errors:

Error1: error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'const char [25]' to 'LPCWSTR'

Error2: error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'(X3)

Error4: error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char [256]' to'LPCWSTR'

Error5: error C2440: 'initializing' : cannot convert from 'WCHAR [260]' to 'char*'

Here is my code that apparently have the errors:

CreateDirectory(".\\TESTFOLDER\\TESTFOLD2ER", NULL);   (This is for Error 1)

CreateDirectory(string, NULL);
break;                          (This is for Error2)


if ((hdl = FindFirstFile(asteriskpath, &data)) == INVALID_HANDLE_VALUE)
    return;       (For Error3)

char* filename = data.cFileName;
char current_dir[256];       (For Error4)

Solution

  • Method 1: set your project character setting to Use Multi-Byte Character Set:

    Configure Properties > General > Project Defaults > Character Set > Use Multi-Byte Character Set


    Method 2: