I am trying to use this function and I was able to debug and narrow it down to this variable called addrstore. I don't know why it is giving me this error. I have tried variables, set numbers, and such but I can't seem to get it to work without it erroring out on me. I am able to ignore the error and the program seems to work just fine but every time I run this, it gives me the error, "String subscript out of range."
Here is the code
void loading(string file){
ifstream object;
BYTE var;
ADDRESS addr;
string input;
object.open(file);
if (!object){
cout << "ERROR: Could not load " << file << endl;
}
else{
string line;
string addrstore;
cout << "loaded the file " << file << endl;
while (!object.eof()){
getline(object, line);
addr = 0;
if (line[0] == 'T'){
for (int x = 1; x < 7; x++){
addrstore[x - 1] = 0;
//addrstore[x - 1] = line[x];
}
addr = numconvert(addrstore);
}
int i = 7;
while (line.size() != 0 && line[0] == 'T' && i < line.size()){
input = line[i] + line[i + 1];
var = numconvert(input);
PutMem(addr, &var, 0);
i += 2;
addr++;
}
}
object.close();
}
}