I'm trying to use the function asctime() and save the function output to a string, but I can't figure out how to do it. What I've posted is the only way I can get it to compile without errors, but it's obviously wrong. Am I missing something obvious?
Code:main() { time_t lt; struct tm t, *tmptr; lt=time(NULL); tmptr=localtime( & lt ); char strings[26]; const char *chptr=strings; chptr=asctime(tmptr); printf("%s\n%s",asctime(tmptr),strings); return 0; }