Hallo,
ich habe diese Funktion :
Gelöst !
Code:
LPCSTR resource(char *File)
{
char cCurrentPath[FILENAME_MAX];
if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
{
}
strncat_s(cCurrentPath,File,FILENAME_MAX-strlen(cCurrentPath)-1); //-1 for null-termination
//MessageBoxA(0,cCurrentPath,"Resource called",0);
//LPCSTR resourcereturn = (LPCSTR) convertCharArrayToLPCWSTR(cCurrentPath);
//MessageBoxA(0,resourcereturn,"",0);
//convert from wide char to narrow char array
//char ch[260];
//char DefChar = ' ';
//WideCharToMultiByte(CP_ACP,0,convertCharArrayToLPCWSTR(cCurrentPath),-1, ch,260,&DefChar, NULL);
//A std:string using the char* constructor.
//std::string ss(ch);
MessageBoxA(0,(LPCSTR)cCurrentPath,"Out",0);
return (LPCSTR)cCurrentPath;
}
Wers braucht :)
LPCSTR resource(char* File)
{
char cCurrentPath[FILENAME_MAX];
if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
{
MessageBoxA(0,"Failed to get the currently Dir!","Error:GetCurrentDir",0x000000000L);
}
strcat(cCurrentPath,File);
return (LPCSTR)cCurrentPath;
}
Diese funktioniert auch.
Der pfad wird in der msgbox 100 % richtig angezeigt.
Sie wird wie folgt aufgerufen:
Das Problem ist:
Das \\ wird zum \ wo druch es seine funktion verliert wie verhindere ich dies ?