/*
#include
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
#include
#include
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;
}
Interpréter une chaîne de caractères comme une valeur numérique de type int
Author: user/*
#include
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
#include
#include
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;
}