Bug#571754: strftime("%c") crashes in (some) locations
Hello Aurelien, Hello Klaus,
This is the example in "man strptime":
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main(void)
{
struct tm tm;
char buf[255];
strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
exit(EXIT_SUCCESS);
}
As we can see, there's no "memset" initializing the entire tm structure.
It would be nice to have a "memset" added in this example, to illustrate
the text "that tm should be initialized before the call".
Regards,
Bart Martens
Reply to: