Today i return my blog and i want to be able to tell about converting kinds of data.
Do you know how to convert between CString and std::string?
This is very important for progamming with MFC application.
There are many ways to do this but i will introduce one of them.
If you want to convert from std::string to CString, you can use syntax:
std::string demo("You are welcome!");
CString convert;
convert(demo.c_str());And if you want to convert vice versa, you can do the following:
CString demo("You are welcome!");
std::string convert;
// If you don't use Unicode format
convert((LPCTSTR)demo);
// If you use Unicode format
CT2CA temp(demo);
convert(temp);I hope you will succeed. Thanks for visiting my blog!
Do your best, the rest will come.
Không có nhận xét nào:
Đăng nhận xét