hi …
i am trying to read my input file but i am ending up in two extra "??".
can you please help me in this to get rid of extra data
please find my input below:
1 xy 2
2 z xy
5 R 1004 I 5678 E 2000 R 8002 E 7001
output:
??1 xy 2
2 z xy
5 R 1004 I 5678 E 2000 R 8002 E 7001
code:
insert
Code:
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
usingnamespacestd;
int main() {
ifstream infile;
string fileName,line,word;
int lineno,wordno,module,i,varcnt,baseaddr[i];
int get;
istringstream instr;
char *worda;
cout << "Enter the name of the file: ";
cin >> fileName;
infile.open(fileName.c_str());
lineno=0;
i=1;
baseaddr[i]=0;
if (infile.is_open())
{
while (getline(infile,line))
{
cout << line << endl
}
}
else
cout << "Unable to open file" << endl;
return0;
}