Hey guys, So I'm working on a project to create an assembler. I am kind of reintroducing myself to C++, and finally after getting my code to compile, I am getting a runtime error. I am using Code::Blocks with the GNU GCC compiler on a windows 7 machine
The Error: "This application has requested the Runtime to terminate it in an unusual way."
From what I can gather, this is due to the terminate() function being called possibly due to an unhandled exception
My Code:
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
string Oper;
string Src;
string Dst;
int OpCode;
char ThisLetter;
char a = ' ';
cout<<"here";
ifstream file;
file.open("Assy.txt");
if (!file.good())
{
cout << "There was an error opening the file." << endl;
return 0;
}
int i = 0;
while(ThisLetter != a)
{
ThisLetter = file.get();
cout<< ThisLetter;
Oper.at(i) = ThisLetter;
i++;
}
cout << Oper;
file.close();
return 1;
}
If I comment out the line:
It works, and the loop exits. The cout statements are purely for debug purposes. Any tips on where to look for a solution to this problem? I hope this is enough information. If you guys need anything else, let me know. Thanks!