Todd Burch,
The solution with string.rfind() and string.substr() sounds interesting. Still I have the problem.
I have never used these functions though and have a little problem to implement them in the code. I have tried but not really get it right.
If you have the time I would appreciate some assistance how an approch could look like for this code.
The line in the file look like this:
ABC,BBB,01/04/2001,01/04/2001,1535
Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main ()
{
std::string Name;
std::string Action;
std::string BDate;
std::string SDate;
char Comma;
int BTime = 0;
ofstream MainResult;
MainResult.open ("MainResult.txt");
ifstream Main ("Main.txt");
while ( getline(Main, Name, ',') )
{
Main >> Action;
Main >> Comma;
Main >> BDate;
Main >> Comma;
Main >> SDate;
Main >> Comma;
Main >> BTime;
Main.get(); // read in trailing newline character
MainResult << BTime << "\n";
} // End Whilestatement
return 0;
}