As you do, you are not called to the function GetLocalTime
(or GetTimeFormat
), you are sending to printf
the memory address of the function (you pass the name of the function directly), when printf
expects its first parameter to be a string of characters. Therefore, in your code, printf
is treating the memory address of the function, as if it were a string of characters, hence it prints you strange things. You should do something like (according to how little I've looked at the Windows documentation, note that those functions are not standard C
, and I do not understand why they require you to do it that way):
// lo suficientemente grande para obtener el formato. La doc de
// windows, como no, no especifica como de grande debe ser.
char formato[30];
int status = getTimeFormat(LOCALE_CUSTOM_DEFAULT,
TIME_FORCE24HOURFORMAT, NULL, NULL, formato, 30);
if (status == 0)
printf("Error. Aun estoy aprendiendo.");
else
printf("%s", formato);
printf("\n");