Convert CString to const char *

If unicode not enabled


CString str = "Hello World";

char *c = (char *)(LPCTSTR)str;

If unicode support is enabled in the project


CString str = _T("Hello World");

string ss = string(CT2CA(str));

const char *cc = ss.c_str();


Get Free Email Updates!

Signup now and receive free offers, discounts & coupon codes

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge