Click to See Complete Forum and Search --> : CString


May 24th, 1999, 05:49 AM
how can I convert a string (say:CString strNumber = '12';) into an integer (int nNumber = 12;)

real name
May 24th, 1999, 06:12 AM
call normal sscanf function giving CString as a first input parameter

real name
May 24th, 1999, 06:14 AM
or maybe better _stscanf

May 24th, 1999, 08:33 AM
Try int nNumber = atoi(strNumber.GetBuffer(0));

Tashbeen Zaman
May 25th, 1999, 04:10 AM
Use nNumber = atoi(strNumber);
It will convert string to Integer.

Use itoa(nNumber,chrNumber,10);
strNumber = chrNumber;
It will convert Number to string.
where chrNumber is an array like
char chrNumber[10];