TCHAR 配列を wstring に変換したいと思います。
TCHAR szFileName[MAX_PATH+1];
#ifdef _DEBUG
std::string str="m:\\compiled\\data.dat";
TCHAR *param=new TCHAR[str.size()+1];
szFileName[str.size()]=0;
std::copy(str.begin(),str.end(),szFileName);
#else
//Retrieve the path to the data.dat in the same dir as our data.dll is located
GetModuleFileName(_Module.m_hInst, szFileName, MAX_PATH+1);
StrCpy(PathFindFileName(szFileName), _T("data.dat"));
#endif
wstring sPath(T2W(szFileName));
szFileName
期待する関数に渡す必要があります
const WCHAR *
完全を期すために、渡す必要があるボイドを述べていますszFileName
。
HRESULT CEngObj::MapFile( const WCHAR * pszTokenVal, // Value that contains file path
HANDLE * phMapping, // Pointer to file mapping handle
void ** ppvData ) // Pointer to the data
ただし、T2W は機能しません。コンパイラは と言っthat "_lpa" is not defined
ていますが、ここからどこに進むべきかわかりません。ネットで見つけた他の変換方法を試しましたが、どちらも機能しませんでした。