I need to get the current time in the format "HH: MM: SS" in an array of characters (string) so that I can output the result later simply with printf("%s", timeString);
I'm pretty confused about types timevaland time_tbtw, so any explanation would be awesome :)
EDIT: So I tried using strftime, etc., and it worked. Here is my code:
time_t current_time;
struct tm * time_info;
char timeString[8];
time(¤t_time);
time_info = localtime(¤t_time);
strftime(timeString, 8, "%H:%M:%S", time_info);
puts(timeString);
But the conclusion is: "13: 49: 53a ?? J`aS?"
What happens to โ a ?? J`aS? โ At the end?
source
share