>>843 フラグがどうも……
#include <ctype.h>

void astring_to_number(char *buff, int *n)
{
    int negative = 0, i = 0;

    if(buff[i] == '-'){
        negative = 1;
        i++;
    }else if(buff[i] == '+'){
        i++;
    }

    while(isdigit(buff[i]))
        *n = 10*(*n) + (buff[i++] - '0');

    if(negative)
        *n *= -1;
}