[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#571754: strftime("%c") crashes in (some) locations



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

But however, lets modify the program slightly to be constructive:
- ---
#define _XOPEN_SOURCE
#include <stdio.h>
#include <time.h>
#include <locale.h>

int main(int argc, char **argv)
{
   char time[255];
   struct tm tm;

   setlocale(LC_ALL, "de_DE");
   strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);

   strftime(time, sizeof(time), "%c", &tm);
   fprintf(stdout, "%s\n", time);
} // int main(int argc, char **argv...
- ---

Now it should be ok for you too. (See, it is nearly the same than the
example in the man page!)

Regards
   Klaus
- -- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <Klaus@Ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS4pft5+OKpjRpO3lAQp/dAgAojs8hOlHzt/H5Y8NTnBGcW5Akk5XRYtK
BI/28G3qcbqR0523/mE3VXfkXDBaa2cWYt911a7CNGkb/J57T4fHwo1due2JT/c+
Y5EwjVXzdAtvISmAi/o/4FbrssWRvWReJgWYxwlFGUKiUB5OPJAsquXsiwJRUL8b
EpqMom5fKmmCzKaqe1Jj6JWb86tecTKfus4dVubSNQlmFHWDngGa9rOYX/oYhWPI
u+ulSGVhKPuE6piORaTFb/3LtyICHDY5LVm+iZAIK7Fccp6/lAisSpkoeePESjkh
TjTs/NhA9PiasAm2/xZR5L9+2tB7DzVI4WQ9h87hwiqxvSAVPXq31g==
=yQmo
-----END PGP SIGNATURE-----



Reply to: