I have this function which is supposed to set a certain time format to the given char*:
static void timeStamp(char* time)
{
time(&strTime);<---ERROR
curTime = std::localtime(&strTime);
strftime(time, 8, "%H:%M::", curTime);
}
strTime and curTime were declared like this:
tm* curTime;
time_t strTime;
but for some reason i get:
called object type 'char*' is not a function or function pointer
on the marked place.
any idea why?
im using xCode by the way.
Your function parameter
timeis a pointer to a char.However, in your function body, you’re trying to treat it if it were a function that you can call. That’s what the error is saying…
Essentially, you’ve hidden the
timefunction by having a local variable of the same name. I’d recommend changing your function parameter’s name.