I'm trying to create substrings from my from each line of my input file.
I noticed that when i create a substring from substr(0,2) position zero it prints out correctly but if I start from anywhere greater than 0 it throws this error:
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string
and Im also reading in lines in this format 40AF FF A9
int main()
{
string STRING;
ifstream infile;
infile.open("test-file.txt");
while(!infile.eof())
{
getline(infile, STRING);
string tag = STRING.substr(2,2);
cout << tag << endl;
}
return 0;