I have a function that returns a date and hour with a specified format.
Code:
int c = 0;
char stringdate[] = {'\0'};
int date(void) {
time_t now;
struct tm *tm_now;
char buff[BUFSIZ];
now = time(NULL);
tm_now = localtime(&now);
strftime(buff, sizeof buff, "%d-%m-%Y:%H:%M:%S", tm_now);
printf("%s", buff);
// stringdate[c++] = buff;
return 0;
}
My program does a scanf of various characters and then in the end of the program it retrieves the date and time of each character inputted.
But i can only retrieve the date and time of the last inputted character.
How can i do this?
Thanks