Macrosoft
2007-11-21 20:17:52
Everytime I debug my script, I get this runtime error:
Unhandled exception at 0x1048153b in SRL 3.81 to SRL 4.exe: 0xC0000005: Access violation writing location 0x00534559.
here is the script
Unhandled exception at 0x1048153b in SRL 3.81 to SRL 4.exe: 0xC0000005: Access violation writing location 0x00534559.
here is the script
#include <iostream>
#include <fstream>
#include <string>
#include <new>
using namespace std;
int main ()
{
char File[150], re[4];
string line[1];
string response;
int x;
int counter=0;
size_t found;
string strtofind[]={"oolean1", "oolean2", "oolean3", "nteger1", "nteger2", "nteger3",
"tring1", "tring2", "tring3"};
string changestr[]={"ooleans[0]", "ooleans[1]", "ooleans[2]", "ntegers[0]", "ntegers[1]",
"ntegers[2]", "trings[0]", "trings[1]", "trings[2]"};
int index;
cout<<" Script Converter\n";
cout<<" By Macrosoft\n"<<"Special Thanks to R0b0t1 for his help\n\n";
cout<<"Would you like to convert a SRL 3.81 script to SRL 4? (yes or no) \n";
cin>>re;
_strupr_s(re);
response=re;
if(response== "YES") {
cout<<"Please enter the name of the file (C:/Program Files/example.scar)"<<endl;
cout<<"the location is not needed if this program and the script are in the same folder\n";
cin.ignore ( 150, '\n' ); //flush the input stream
cin.getline(File, 150);
cout<<"Now Converting "<< File<< " to SRL 4 ..."<<endl;
ifstream fin;
ofstream fout;
fin.open(File);
if(fin){
while (getline(fin, line[counter])){ //this is where the "arrow" is at when there is the error
string* line = new string[counter];
counter++;
}
x=counter;
for(counter=0; counter<x+1; counter++){
for(index=0; index<9; index++){
found=line[counter].find(strtofind[index]);
if (found!=string::npos){
line[counter].replace(int(found), strtofind[index].length(), changestr[index]);
}
}
}
fout.open(File);
fout<<"{Script Converted to SRL 4 by Macrosoft's Script Converter}\n";
for(counter=0; counter<x+1; counter++){
fout<<line[counter]<<"\n";
}
cout<<"Finished converting script\n";
}
else {
cout<<"Failed to open file\n";
}
fin.close();
fout.close();
}
else if(response == "NO"){
cout<<"Closing Program...\n";
}
else{
cout<<"Response not understood. Closing Program...\n";
}
system("PAUSE");
return 0;
}