Convert string to integer problem!

I want nCycle to get the value 24 like szBufCYCLE has. What have I done wrong?

char szBufCYCLE[10];
int nCycle;
GetPrivateProfileString("GENERAL", "CYCLE", "StringNotFound",szBufCYCLE, sizeof(szBufCYCLE)-1, lpszFileName);
MessageBox(szBufCYCLE, "Cycle", MB_OK); //Shows 24
nCycle = (int) szBufCYCLE;
char T[10];
MessageBox(itoa(nCycle, T, 10), "n", MB_OK);
//Shows 1324975 (something that is not 24)

Who is Participating?
bluemaskConnect With a Mentor Commented:

nCycle = atoi(szBufCYCLE);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.