samedi 30 avril 2016

wrong pointer type c++

I'm getting the error:

error: request for member 'tm_sec' in 'timeinfo', which is of pointer type 'tm*' (maybe you meant to use '->' ?)

And my code is:

time_t rawtime;
struct tm * timeinfo;
time (&rawtime);
timeinfo = localtime (&rawtime);
int counter = 0;
std::string currentTime = asctime(timeinfo);

timeinfo.tm_sec = timeSeconds;

std::string timeSecondsString = std::to_string(timeSeconds);
std::string counterString = std::to_string(counter);
const char* timeChar = timeSecondsString.c_str();
const char* counterChar = counterString.c_str();

while(timeinfo.tm_sec = timeSeconds)
{
  counter = counter + 1;
}

if(timeinfo.tm_sec != timeSeconds)
{

   SDL_SetWindowTitle(gWindow, counterChar);
  counter = 0;
}

How would I go about fixing this? Also if I don't need any of the lines of code it would be nice to know.

Aucun commentaire:

Enregistrer un commentaire