K, heres the function that must be causing the problem:
Code:
void compile(char *sourcefile, int type)
{
char *line=new char; //get a line from the source file
char command[256]={0}; //stores commands found in the line
// int i=0; //used in various for...loops
bool done=false; //when we exit the loop
ifstream source(sourcefile); //file to read from
source.close();
ofstream output("output.txt"); //file to write output code to
output.close();
output.open("output.txt"); //open the output file to write to
source.open(sourcefile); //open the source file to read
source.getline(line,256); //get a line from the file
do
{
cout << line<<endl; //print the line for debug purposes
//COMMENTED OUT THESE FUNCTION CALLS, IT STILL CAUSES ERROR
//SO THE PROBLEM IS SOMEWHERE WITHIN THIS FUCTION
//p_start_program(line,type); //PARSE FOR: start program
//p_print(line,type); //print
//p_input(line,type); //input
//if(p_end_program(line,type)==true)
//{
// done=true;; //end program
// cout << "COMPILER: finshed with end program"<<endl;
//}
if(done==false) source.getline(line,256); //get a line from the file
if(done==false) line=a_remove_space(line); //remove whitespace from a line
//JUST HERE TO SHOW THAT IT STILL CAUSES THE ERROR EVEN IF IT ONLY
//RUNS THROUGH THE LOOP ONCE
done=true;
}while(done==false);
I commented out the other function calls, and it gave me the same error, so it has to be in this function. Thanks