Wednesday, May 13, 2009

C++ - How to convert between 'CString' and 'std::string'?

Simple But Still Annoying



'CString' to 'std::string'

Code:


CString cs("Hello");
std::string s((LPCTSTR)cs);


'std::string' to 'CString':

Code:

std::string s("Hello");
CString cs(s.c_str());

0 תגובות:

Post a Comment

 
Home | About | Link | Link
Simple Proff Blogger Template Created By Herro | Inspiring By Busy Bee Woo Themes