I am trying to create a program wich can create registry subkeys/values by itself but I am facing a frustrating problem. I try to concatenate the path and the future name of the subkey to have the absolute path for the Reg functions. I can create keys if I set the path manually, but now that I try to concatenate (using wcscat), the program crash.
Here is the program until it goes wrong.
int main(int argc, char *argv[])
{
HKEY hKey = NULL;
DWORD data = 0;
wchar_t *path = L"SOFTWARE\\7-Zip\\";
const wchar_t *name = GetWC(argv[1]); //argv[1] is char* and name is const wchar_t*.
wcout << "path : " << path << endl << "name : " << name << endl;
wchar_t *strKeyName = wcscat(path, name);
Any advise would be really appreciated, if you need more informations it wont ba a problem :)
(This is my very first post, if you have advice concerning the form too, don't restrain yourself) :D
Thank you a lot !!! I tried it earlier but I gess I lost myself in the conversions... Now the system is fully operating ;D
(Here is the difference between earlier, if it can help someone)
(int main(int argc, char *argv[])
{
HKEY hKey = NULL;
DWORD data = 0;
std::string path = "SOFTWARE\\7-Zip\\";
std::string name = argv[1];
path += name;
cout << "path : " << path << endl;
std::wstring str= std::wstring(path.begin(),path.end());
wcout << "str: " << str; //debug
wchar_t *strKeyName = const_cast<wchar_t*>( str.c_str() );