12/14/2016

ctime_s and ctime example


#include < time.h >
#include < stdio.h >

int main(void)
{
time_t result = time(NULL);
//printf("%ld \n", result);
//printf("%s \n", ctime(&result));

char str[26];
ctime_s(str,sizeof str,&result);
printf("%s \n", str);

}


-> result
Thu Dec 15 02:29:54 2016

No comments:

Post a Comment