nav-left cat-right
cat-right
Matthias Pospiech > Programming > C++ > MFC > Convert Cstring to int

Convert Cstring to int

The solution is the following

CString samplecstring;	
int i = _ttoi(samplecstring);

further conversion examples are listed at http://www.codeproject.com/cpp/data_conversions.asp.

Converting backwards from int to CString can be done via

int i  = 255;
Cstring text;
text.Format(_T("%d"), i);

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*

This blog is kept spam free by WP-SpamFree.