How to convert const char* to const WCHAR*. 2. Converting 'const char*' to 'LPCTSTR' for CreateDirectory. 2. C++ - how to convert between types that are only known at runtime.
LPCTSTR is either defined as a const wchar_t * or a const char * depending on whether your project defined the preprocessor symbol UNICODE (or _UNICODE, I forget which one MFC uses).
How do I convert from CString to const char* in my Unicode MFC application?
How do I make this conversion? The next step is to set today's date as a string or char and concatenate it with the filepath.
There exist set of conversion routine to convert MBCS to Unicode and vice versa, which I would explain soon.
All that is left to do is use AnsiToOem() but i get the cannot convert from 'const char *' to 'LPCTSTR', i know that LPCTSTR is a windows 4 byte, so my question is there a way ?
9. char array to LPCTSTR conversion in c. 0. C basic datatype problem - const char * to LPCTSTR.
Re: CString to const char*. Originally Posted by Paul McKenzie. Use the LPCTSTR() conversion operator for CString.
The LPCTSTR type extends to const TCHAR*, where TCHAR is char when you compile for multi-byte and wchar_t for unicode. Since the compiler doesn't accept the char array, we can safely assume that the actual type of TCHAR, in this compilation, is wchar_t.
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char ' to 'LPCTSTR'.