I am basically trying to get the time with
struct timeval tv = { };
gettimeofday(&tv, NULL);
And it works. The problem is that the function that is going to accept as an argument the time is of type const char*
So i did
const char *time;
time = &tv.tv_sec;
The problem is, that tv.tv_sec is of type time_t and i need to plug it in
const char *time
to pass it on to the function that needs const char*
How do i do it? Placing an integer into a const char*
I’ve tried some simple ways of casting it, however i am not that experienced with C
To format an integer as a string you should use
snprintf.For example: