It will probably be faster to use the tm struct, as unregistered said. See function localtime() to use it. But if you wish:
Code:
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
int main(void)
{
char date_time[26] = "Fri Apr 26 09:47:43 2002";
char time_string[7] = "";
int t;
strncat(time_string,date_time+11,2);
strncat(time_string,date_time+14,2);
strncat(time_string,date_time+17,2);
t = atoi(time_string);
cout << "time:" << time_string << endl;
cout << "time:" << t << endl;
return 0;
}
Just make sure an int is 4 bytes on your machine, or you will need a long instead of an int (use atol() instead of atoi()).