로 난 SIC/XE를 .ASM 파일 symtab을 만들 쓴 코드 ....파일 처리 문제 (하나 개 이상의 필드를 가지는 파일) 그것이 여기
#include<iostream>
#include<fstream>
#include<iomanip>
#include"aviasm.h"
using namespace std;
void aviasm::crsymtab()
{
ofstream outs("symtab.txt",ios::out);//creating the symtab
ofstream outi("intermfile.txt",ios::out);//creating the intermediate file
ifstream in("asmfile.txt",ios::in);//opening the asmfile which i have already written
in.seekg(0,ios::beg);
char c;
string str[3];
string subset;
long locctr=0;
int i=0;
while((c=in.get())!=EOF)
{
in.putback(c);
while((c=in.get())!='\n')
{
in.putback(c); //putting back the first encountered letter
in>>str[i++]; //the asm file has three or less fields in every row
}
if(str[0].size()!=0 && str[1].size()!=0 && str[2].size()!=0)//if all 3 are there
{
if(str[1]=="start")
{
outi<<hex<<locctr;
outs<<str[1]<<" "<<locctr<<"\n";
outs<<resetiosflags(ios::hex);
outi<<" "<<str[0]<<" "<<str[1]<<" "<<str[2]<<"\n";
locctr=stol(str[2],0,16);
}//str[1]=start
}//end of all the three fields
}
in.close();
outi.close();
outs.close();
}//end of crsymtab
이다 연관된 .. ... 여기에 샘플 sic/xe .asm file ..... 위의 코드에서 위 코드를 제외한 코드의 전체 부분을 주석으로 처리하더라도 문제가 발생하기 때문에 전체 코드가 포함되어 있지 않습니다. 코드를 실행할 때마다 발생합니다 :
메시지 상자가있는 경우 :
'Unhandled exception at 0x00ba7046 in aviasm.exe: 0xC0000005: Access violation writing location 0xcccccccc.'
이 표시됩니다. 콘솔에 또한static void __CLRCALL_OR_CDECL assign(_Elem& _Left, const _Elem& _Right) { // assign an element _Left = _Right; }
, I 출력 몇 마디 : 내 프로그램은 또한
iosfwd(std::char_traits<char>)
라는 이름의 파일이 선 다음 함수의_Left=_Right;
에서 화살표가 나타납니다 ...
디버깅 모드로 들어갑니다 블록 시작과 끝 부분에서이 함수가 작동하는지 확인하려면str[1]="start"
... 두 줄이 모두
일 뿐이며 입력이 성공적으로 프로그램에 의해 수행 된 것임을 확신합니다. asm 파일 ed this), intermfile 및 symtab에 출력되는 행이 없습니다 ... plz help ??
"코드를 실행할 때마다 문제가 발생합니다."및 "컴파일 할 때 예외가 발생했습니다."잘 맞지 않는 것 같습니다 ... – PlasmaHH