I'm trying to convert a TCHAR to a string as in:
std::string mypath;
TCHAR path[MAX_PATH];
GetModuleFileName( NULL, path, MAX_PATH );
I need to set mypath
to that of path
. I did a simple loop and concatenated path[index]
to mypath
and this works but I don't like this way.
I'm new to C++ but have done plenty of C#. I've seen examples of the GetModuleFileName
that passes in a "char" but it doesn't like it. It needs the TCHAR
or a LPWSTR
.
TCHAR
:typedef std::basic_string<TCHAR> tstring;
and usetstring
everywhere. – Cyperaceous