-
returning strings
char *GetFormattedTime() {
char Time[1024];
ZeroMemory(Time, sizeof(Time));
GetTimeFormat(LOCALE_USER_DEFAULT, NULL, NULL, "hh':'mm':'ss tt", Time, sizeof(Time));
return Time;
}
now, this works when i go "
MessageBox(NULL, GetFormattedTime(), "", MB_OK);
but when i try to write to a file:
fprintf(FILE, GetFormattedTime());
it only prints two characters: 0
any ideas what's wrong?
-
I believe you're missing your formatting:
/code
fprintf( stream, "%s", GetFormattedTime( ) );
/code
See if that doen't help.