It is not clear about the 1337 thing... however, this code should produce what the question code is attempting with simplified logic.
long int toNumber(char **input)
{
char *pointer;
long int number;
number = strtol(input, &pointer, 10);
if(number)
*input = pointer;
else
number = (1337);
return number;
}
Something like the following call the above function:
{
char *test="123 456";
long int n;
...
n = toNumber(&test);
printf("n[%ld] remainder[%s]\n", n, test);
...
}
Which should print:
n[123] remainder[ 456]