I am currently trying to read information from an .txt file and essentially store this appropriately. Data from the input file would look something like this
10 10 10 10 10 10 20 20 20 15 15 15 15 15 15 15 20 30 20 15 15 10 10 10
765DEF 01:01:05:59 enter 17
ABC123 01:01:06:01 enter 17
765DEF 01:01:07:00 exit 95
ABC123 01:01:08:03 exit 95
My question is that, assuming I have read "01:01:05:59" into a string, how do I parse this to store the numbers in an int variable. In addition, all I really need is the third pair of numbers in that string(from the left) and I was also wondering how to skip the first two and last pair of numbers in that string. I have read on delimiters but I'm a little confused on how to use them. The code I have so far is shown below and is basically that information to strings.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
int arr[25];
ifstream File;
File.open("input.txt");
for (int a = 0; a < 25; a++)
{
File >> arr[a];
}
for (int i = 0; i < 25; i++)
{
cout << arr[i] << " ";
}
cout << endl;
string license, datetime;
File >> license >> datetime; // reads in license plate and datetime information into two separte strings
cout << license << endl << datetime;
system("pause");
}