The function works fine. For example, if it buffcontains "123", your code will print 123233.
However, it looks like you just want to print the value of the individual digits, and in this case atoihas nothing to do with your problem. Try:
for(p = buff; *p; p++)
printf("%d", *p-'0');
source
share