I compiled this code in dev c++ and i got 0 warnings and 0 errors, so it was a clean compile and whenever i run the exe i get this error which says
assembler.exe has encountered a problem and needs to close. And gives me the error report thingy for microsoft. I was wondering if someone else can compile the code and run it on there machine to see if its just my machine or something and if they have advice on why the program is crashing everytime. Thanks in advance
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
string op;
int val1;
int val2;
string val3;
string val4;
int ElementAmount;
ifstream sourcefile;
sourcefile.open("program.code");
while (sourcefile >> op >> val3 >> val4)
{
ElementAmount = ElementAmount + 3;
}
sourcefile.close();
char binary[ElementAmount];
ifstream sourcefile1;
sourcefile1.open("program.code");
while (sourcefile1 >> op >> val1 >> val2)
{
if (op == "storeByte")
{
// storeByte 0 20
}
if (op == "storeWord")
{
// storeWord 0 20
}
if (op == "storeDword")
{
// storeDword 0 20
}
if (op == "moveMR")
{
// moveMR Eax 23
}
if (op == "moveRM")
{
// moveRM 2 Eax
}
if (op == "moveRR")
{
// moveRR Eax Ebx
}
if (op == "add")
{
// add Eax Ebx
}
if (op == "sub")
{
// sub Eax Ebx
}
}
sourcefile1.close();
ofstream binaryfile;
binaryfile.open ("program.bin", ios::out | ios::binary);
binaryfile.write (binary, 512);
binaryfile.close();
}