I am running this loop where I am substr a vector like below and then ´creating´ a new string "NewData" that I will pushback in a new vector.
The thing is that I got an Error message when running this code but if I instead change these 3 lines to this, then it will work:
One = ReadInData;
Two = ReadInData;
Three = ReadInData;
I cant understand why it works when I take the .substr away. The entire strings from the beginning are about 40 characters so the characters that I am trying to substr do exist ?
std::vector<string> ReadInDataCorrectDates;
std::string One, Two, Three;
std::string NewData;
for (int i = 0; i < countLines; i++)
{
One = ReadInData[i].substr(0, 2);
Two = ReadInData[i].substr(3,2);
Three = ReadInData[i].substr(6,4);
NewData = Three + Two + One + ReadInData[i];
ReadInDataCorrectDates.push_back(NewData);
}