Well, in my code I create a directory and a file in the place where the .exe file is. I found a function in this forum that returns the path location of the .exe file (because I can run the program in different places). Then, I want to move the file to inside the created directory, but I can't use the return value of current_working_directory() in MoveFile(). This is what I got so far...
***********PROBLEM SOLVED!!!*************
The solution was so simple... Just use current_working_directory().c_str() =X
string current_working_directory()
{
string add = "\\Private\\Password.dat";
// This is right? I want to put the file inside the Private folder
char working_directory[MAX_PATH + 1];
GetCurrentDirectoryA(sizeof(working_directory), working_directory);
return working_directory + add;
}
if (checkFile("Password.dat") == false)
// If the Password.dat doesn't exist, then the user must create a password =P
{
ofstream passwordSave;
passwordSave.open("Password.dat");
cout << "Create a password: ";
cin >> password;
passwordSave << password;
passwordSave.close();
MoveFile("Password.dat", current_working_directory());
// Here is where I want to move the file, but it gives me
// No suitable conversion function from std::string to LPCSTR exists
return 0;
}