[ create a new paste ] login | about

Link: http://codepad.org/dm33Th9Q    [ raw code | output | fork ]

slevy1ster - C, pasted on Oct 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <stdlib.h>

int main()
{
   char str[30] = "0128912";
   char *ptr;
   long ret;
   
   ret = strtol(str, &ptr, 0);
   printf("Input: %s\n",str);
   printf("Result is %ld\n", ret);
   if (*ptr != '\0')        
        printf("Discarded: %s\n", ptr);
   return(0);
}


Output:
1
2
3
Input: 0128912
Result is 10
Discarded: 8912


Create a new paste based on this one


Comments: