atoi not working inside of loop

Joined
Jan 7, 2008
Messages
3
Reaction score
0
Hello, when I take the loop away the atoi call works fine. But when the for loop is wrapped around the atoi call, it seems like the char array goes out of scope or something and I do not get an int returned from the atoi call.

Code:
for(int j=0; j<length; j+=4)
{
 char Num[2];
 Num[0] = Buffer[j];
 Num[1] = Buffer[j+1];
 int num = atoi(Num);
}
length *= 4;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top