You can use _wtoi() or _ttoi() to convert a CString into int.
#include "atlstr.h" #include <iostream> using namespace std; int main () { // Create a CString with number CString intStr = _T("123"); // Convert the CString into int int aInt = _wtoi(intStr); // 123 + 123 = 246 aInt += 123; // Print 246 to cout cout << aInt << endl; // Pause system("PAUSE"); // Terminate the program: return 0; }
Done =)
Reference: