dans le code ci-dessous je suis le c: \ windows \ Microsoft.Net \ Framework \ v2.0.057 au tampon.Maintenant, je wnat pour stocker la valeur ci-dessus dans doble quotes "c: \ windows \ Microsoft.Net \ Framework \ v2.0.057" et je veux passer cela pour le processus. comment faire ce chemin entre guillemets ....Comment stocker la valeur wchar dans la chaîne de guillemets double
HINSTANCE hDLL = LoadLibrary(TEXT("mscoree.dll"));
FNPTR_GET_COR_SYS_DIR GetCORSystemDirectory = NULL;
GetCORSystemDirectory = (FNPTR_GET_COR_SYS_DIR) GetProcAddress (hDLL,"GetCORSystemDirectory");
if(GetCORSystemDirectory!=NULL)
{
WCHAR buffer[MAX_PATH + 1];
DWORD length;
HRESULT hr = GetCORSystemDirectory(buffer,MAX_PATH,&length);
std::string tbuf="\"buffer\"";
// std::string tbuf=" \""+(string)buffer+"\\InMageSQL.dll\" /codebase /tlb /silent";
if(S_OK==hr)
{
wcscat(buffer,L"RegAsm.exe");
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi)); //(LPSTR)getcurrentpath.c_str()
if(!CreateProcess((LPCTSTR)buffer,(LPTSTR)strInMageSqlDll.c_str(),NULL, NULL,FALSE, 0,NULL,NULL,&si,&pi))
{
cout<<"CreateProcess failed "<<GetLastError()<<endl;
}
Vous ne pouvez ajouter des chaînes wchar_t à basic_string –
@ Steve, bonne prise. Switched to wstring – JaredPar
@JaredPar: Mais vous ne pouvez pas non plus affecter un 'const char []' à un 'std :: wstring'. – sbi