how do i convert a string to LPCSTR?
-
:omg:as title
-
:omg:as title
-
:omg:as title
1. To convert a CString to a LPCSTR
#include <atlconv.h>
USES_CONVERSION;
CString str = _T("Whatever");
LPCSTR lpsz = T2CA(str);2. To convert a std::string to a LPCSTR
std::string str("Whatever");
LPCSTR lpsz = str.c_str(); // No T2CA() required - std::string is always ANSI3. To convert a std::wstring to a LPCSTR
#include <atlconv.h>
USES_CONVERSION;
std::wstring(L"Whatever");
LPCSTR lpsz = W2CA(str);Hope this helps Have a look at the tutorial on string handling on CP. That will say more :) Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"