Substring Out Of Range? File Stream ()

Hey guys, i'm Working On A Project That Gets All Employees And Their Data From the User Then Saves Them in A Txt File ( Fstream )

Anyway, i figured out how to Do That But What im at stuck at now is how to search through the txt file , i figured that i got to get all the data from the txt file into the console when i start the program so i did all of that and divided all the data between < >
For example : < ID > <Name > <Rank>... etc
so When he Finds the < : He starts to Get the line Inside then when he finds the > He gets out of the If Condition

Anyway i got a Char C And defined it to be the First Array of the StructureArray so It GETS The "<" inside it but when i did that
i got this message " SubString Out OF Range" Can Anyone Plz Tell me what that means or Even how to fix it?

Here's a part of the Code

int index;
string id;
employees_data data[1000];
char ch;
vector <employees_data> MyData;
fstream PRUJECT;
PRUJECT.open ("Project.txt");
employees_data tmp[1000];
//
string s[1000];
string Name[100], address[100], rank[100], hoursworked[100], overtimehours[100];
char c;
for(int i=0; !PRUJECT.eof(); i++)
{
// ID
getline(PRUJECT,s[i]);
index = s[i].find('=')+1;
tmp[i].ID= s[i].substr(index, s[i].size()-1);
MyData.push_back(tmp[i]);
c=tmp[0].ID[0];
if (c=='<')
{
tmp[i].ID=s[i].substr(1, s[i].size()-2);
}
if (c=='>')
continue;
// NAME
getline(PRUJECT,s[i]);
index = s[i].find('=')+1;
tmp[i].name = s[i].substr(index, s[i].size()-1);
MyData.push_back(tmp[i]);
c=tmp[0].name[0];
if (c=='<')
{
tmp[i].name=s[i].substr(1, s[i].size()-2);
}
if (c=='>')
continue;


And So On For The Rest Of The Data...
AnyHelp is So Much Appreciated! Thanks : P
"index" is probably std::npos, which is basicly the largest number an unsigned int can hold, which makes it out of range.
Uh so How do i fix that?
You should add an if statement, so prevent that.
Sorry if my questions are abit stupid but you could say i'm a beginner : P
Prevent what exactly? : )
Topic archived. No new replies allowed.