I have a problem with my log function, I tried to create a log method, which prints the current time in brackets before, but it don't work. Every time null is printed instead of the string.
This is my log
function:
void log(char *szDebugString)
{
printf("%s", szDebugString); //only for debug
time_t currentTime;
time(¤tTime);
printf("%s", szDebugString); //only for debug
printf("[%d] %s\n", currentTime, szDebugString);
}
Now when i'm calling the function:
log("test\n");
I get the following output on the console(time variies):
test
test
[1414078074] (null)
So my question is, why the string in the third printf
is null?