/* #include <stdlib.h> long strtol ( const char * restrict s , char ** restrict endptr , int base ); long long strtoll ( const char * restrict s , char ** restrict endptr , int base ); (C99) */ #include <stdlib.h> #include <ctype.h> #include <stdio.h> int main(void) { char date[ ] = "2011-03-11, 16:44:18 +0100", *dnt = date; long annee, mois; annee = strtoll( dnt, &dnt, 10 ); mois = strtol( dnt+1, &dnt, 10 ); return 0; } |
----------------------------------------------------------------------------