Hi, I am trying to convert char to time and I found the following code. But it gives me a -1 on "converted" instead of time. What am I doing wrong? Please help.
#include <stdio.h>
#include <time.h>
#include <iostream>
using namespace std;
int main()
{
int hh, mm, ss;
char charTime[] = "20:44:57";
char *pTime = charTime;
Thanks for the code. I am trying to convert the struct tm to time_t format using mktime (converted = mktime(&when);) but it returns me a -1 which I read is an error.
I am also trying to compare time. For the moment, what I did was convert all the time to seconds and compare.