Hi Guys,
I want to read a huge file which contains address bits, data bits and instruction bits. Please let me know how to do this.
Cheers,
Bond
Hi Guys,
I want to read a huge file which contains address bits, data bits and instruction bits. Please let me know how to do this.
Cheers,
Bond
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
using std::ifstream;
using std::ofstream;
using std::cout;
int main( )
{
ifstream fin;
ofstream fout;
fin.open("trace.txt");
if (fin.fail( ))
{
cout << "Input file opening failed.\n";
exit(1);
}
fout.open("stats.txt");
if (fout.fail( ))
{
cout << "Output file opening failed.\n";
exit(1);
}
int next;
int n = 1;
fin.get(next);
fout << n << " ";
while (! fin.eof( ))
{
fout << next;
if (next == 1)
{
n++;
fout << n << ' ';
}
fin.get(next);
}
fin.close( );
fout.close( );
return 0;
}
How huge is huge? What problem are you having?
How huge is huge? What problem are you having?
The thing is that--- I am trying take a trace of the traffic flowing in the bus which connects the memory components, i am not yet done with pulling the trace out. This trace contains address bits, data bits and instruction bits. The problem with me is like, i want read the trace.txt to analyze it. This trace.txt is expected to be very huge as we running large application programs on the machine.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.