#include <stdlib.h>
|
long
atol (const char *nptr); |
long long
atoll (const char *nptr); |
It is equivalent to:
strtol(nptr, (char **)NULL, 10);The atoll function converts the initial portion of the string pointed to by nptr to long long integer representation. It is equivalent to:
strtoll(nptr, (char **)NULL, 10);
#include <stdlib.h> #include <stdio.h> void main( void ) { /* call to atol */ long l = atol( "-000002344" ); printf( "result of atol: %ld\n", l ); }
Output
result of atol: -2344
#include <stdlib.h> #include <stdio.h> void main( void ) { /* call to atoll */ long long l = atoll("454756356bs"); printf( "result of atoll: %ld\n", l ); }
Output
result of atoll: 454756356
© 2005-2007 Nokia |