I am converting windows library to linux. I need to find LPTSTR and LPCSTR in linux.
I get to know that i can use wchar_t can be used but I am not really sure about using it.
one of the method that uses LPTSTR is as follows:
void ErrorExit(LPTSTR zFunction)
{
}
Any help will be appreciated!
In Linux you don't usually use
wchar_tfor library API functions. Most libraries use UTF-8 encoded strings, so they take as strings plain arrays of NUL-terminated chars (IMO that is far better than duplicating all the functions with ANSI and Unicode versions).So, with that in mind:
LPCTSTR,LPCSTR,LPCWSTR->const char *.LPTSTR,LPSTR,LPWSTR->char *.If you insist in using Unicode functions, MS style, you have to be aware that they actually use UTF-16 encoded strings, and
wchar_tis not a portable type, as its size is not specified by the language. Instead you can useuint16_t:LPCWSTR->const uint16_t *.LPWSTR->uint16_t *.And if you want to be extra MS compatible, you can use the
UNICODEmacro to conditionally typedef theLPTSTRandLPTCSTRinto one of the others, but that's probably unneeded for your problem.