makaveliuk
Programmer
I have got a really annoying problem that I just cannot solve, look at the following code:
char szCount[20];
memset(szCount, 0, sizeof(szCount));
memcpy(szCount, (void *)strPageCount.GetBuffer(strPageCount.GetLength()), strPageCount.GetLength());
m_iPageCount = atoi(szCount);
The strPageCount is a CString containing a 2 digit+ number, when I copy it, szCount contains all the digits but when I run the atoi() function, it only converts the first character.
I have also tried atoi(strPageCount) which doesn't work and strcpy instead of memcpy and atoi(strPageCount.GetBuffer(strPageCount.GetLength())) and none of those work.
Any ideas?
char szCount[20];
memset(szCount, 0, sizeof(szCount));
memcpy(szCount, (void *)strPageCount.GetBuffer(strPageCount.GetLength()), strPageCount.GetLength());
m_iPageCount = atoi(szCount);
The strPageCount is a CString containing a 2 digit+ number, when I copy it, szCount contains all the digits but when I run the atoi() function, it only converts the first character.
I have also tried atoi(strPageCount) which doesn't work and strcpy instead of memcpy and atoi(strPageCount.GetBuffer(strPageCount.GetLength())) and none of those work.
Any ideas?