Hi,
I have a problem in hand now.Any help is appreciated.
I have 2 files.I have to read data from 1 file & write to another file.Iam doing that right now as follows:
Opening the "file to read" in a stream.Reading it to a buffer & then writing the buffer to the "output stream".(In Binary mode)
The code is like as follows:
// opening the file to read
ifstream inputFile("File to read",ios::in|ios::binary);
if(inputFile.is_open())
{
istream::pos_type beginpos = inputFile.tellg();
inputFile.seekg(0,ios::end);
istream::pos_type endpos = inputFile.tellg();
inputFile.seekg(0, ios::beg);
int numBytes = endpos - beginpos;
char *buffer= new char[numBytes+1];
inputFile.read(buffer,numBytes);
//File to write
if(!OutPutFile.eof())
m_ResourceGroup.seekp(0,ios::end);
OutPutFile.write(buffer,numBytes);
}
Now this way of writing is causing performance problems.I would like to use the istream & ostream iterators instead of the "read" & "write" calls.Iam no good in iterators & I havent used it in file operations.
Can any one show me how to do it with respect to my code above...
Thanks...
