"c++ lpctstr to char*" Code Answer

5

in mfc the easiest is to convert through cstringa (provided that resulting buffer will be a read-only argument):

lpctstr psza = ...
cstringa sb(psza);
const char* pszc = sb;
char* pszd = const_cast<char*>(pszc);

other options are available and were discussed:

  • c++ convert from lpctstr to const char *
  • how to convert from lpctstr to lpstr?
  • widechartomultibyte, t2a macros etc.
By Darryl Buchanan on August 25 2022

Answers related to “c++ lpctstr to char*”

Only authorized users can answer the Search term. Please sign in first, or register a free account.