Original Post
i want to convert a:
char name[50];
to either
TCHAR * atName;
or the preffered one:
LPTSTR atName;
my program keeps crashing when i try things like strcpy or sprintf,
thanks
char cstr[] = "pie in the sky";
LPTSTR wstr = cstr;
const char*.
// ----------------------------------------------------------------------------
//
//
BOOL UnicodeToAnsi(
LPWSTR pszwUniString,
LPSTR pszAnsiBuff,
DWORD dwAnsiBuffSize
)
{
int iRet = 0;
iRet = WideCharToMultiByte(
CP_ACP,
0,
pszwUniString,
-1,
pszAnsiBuff,
dwAnsiBuffSize,
NULL,
NULL
);
return ( 0 != iRet );
}
// ----------------------------------------------------------------------------
//
//
BOOL AnsiToUnicode(
LPSTR pszAnsiString,
LPWSTR pszwUniBuff,
DWORD dwUniBuffSize
)
{
int iRet = 0;
iRet = MultiByteToWideChar(
CP_ACP,
0,
pszAnsiString,
-1,
pszwUniBuff,
dwUniBuffSize
);
return ( 0 != iRet );
}
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more