csripriya1
Programmer
Hi all,
I want to read in a large file and then split into smaller files as per some pattern. I am using fstream in C++. My executable slows after some time. I am seraching a way to speed up this process. Can any one please help me with this.
My code is as follows.
ifstream inpfile(stra,ios::in);
if(!inpfile)
{
cerr<<"File could not be opened"<<endl;
exit(1);
}
ofstream outfile(outputfile,ios:ut|ios::app);
if(!outfile)
{
cerr<<"File could not be opened"<<endl;
exit(1);
}
.......
in=1;
while(in<=limit1)
{
inpfile.getline(dummy,1000,'\n');
outfile<<dummy<<endl;
in++;
}
............
in=1;
while(in<=limit2)
{
inpfile.getline(dummy,1000,'\n');
outfile<<dummy<<endl;
in++;
}
Thank you very much for your time and effort in advance.
I want to read in a large file and then split into smaller files as per some pattern. I am using fstream in C++. My executable slows after some time. I am seraching a way to speed up this process. Can any one please help me with this.
My code is as follows.
ifstream inpfile(stra,ios::in);
if(!inpfile)
{
cerr<<"File could not be opened"<<endl;
exit(1);
}
ofstream outfile(outputfile,ios:ut|ios::app);
if(!outfile)
{
cerr<<"File could not be opened"<<endl;
exit(1);
}
.......
in=1;
while(in<=limit1)
{
inpfile.getline(dummy,1000,'\n');
outfile<<dummy<<endl;
in++;
}
............
in=1;
while(in<=limit2)
{
inpfile.getline(dummy,1000,'\n');
outfile<<dummy<<endl;
in++;
}
Thank you very much for your time and effort in advance.