[ create a new paste ] login | about

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

C, pasted on Nov 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdlib.h>

int main()
{
    char* inStr = "123.4567";
    char* endptr;
    
    char* loc = strchr(inStr, '.');
    long mantissa = strtod(loc+1, endptr);
    long whole = strtod(inStr, endptr);

    printf("whole: %d \n", whole);
    printf("mantissa: %d", mantissa);
   

return 0;
}


Output:
1
2
whole: 123 
mantissa: 4567


Create a new paste based on this one


Comments: