vermarajeev
13th August 2007, 08:23
Hi guys,
Please help me to read the attached binary file "exactly" to some other file.
The copied file has to be same.
Here is the code that I use. But the copied file is modified.
QString message;
QFile f ( "m1_enc.ct" );
if ( f.open (IO_ReadOnly) )
{
// file opened successfully
QDataStream t ( &f );
// read the contents of the file into message
char* m = new char[f.size() +1];
t.readRawBytes ( m, f.size() );
message = m;
f.close();
}
QFile f ( "copied_file_enc.ct" );
if ( f.open (IO_WriteOnly) )
{
// file opened successfully
QDataStream t ( &f );
// read the contents of the file into message
t << message;
}
f.close();
In my case the copied_file_enc.ct is modified.
Please help me to read the attached binary file "exactly" to some other file.
The copied file has to be same.
Here is the code that I use. But the copied file is modified.
QString message;
QFile f ( "m1_enc.ct" );
if ( f.open (IO_ReadOnly) )
{
// file opened successfully
QDataStream t ( &f );
// read the contents of the file into message
char* m = new char[f.size() +1];
t.readRawBytes ( m, f.size() );
message = m;
f.close();
}
QFile f ( "copied_file_enc.ct" );
if ( f.open (IO_WriteOnly) )
{
// file opened successfully
QDataStream t ( &f );
// read the contents of the file into message
t << message;
}
f.close();
In my case the copied_file_enc.ct is modified.