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.
if ( f.open (IO_ReadOnly) )
{
// file opened successfully
// read the contents of the file into message
char* m = new char[f.size() +1];
t.readRawBytes ( m, f.size() );
message = m;
f.close();
}
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();
}
To copy to clipboard, switch view to plain text mode
QFile f
( "copied_file_enc.ct" );
if ( f.open (IO_WriteOnly) )
{
// file opened successfully
// read the contents of the file into message
t << message;
}
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();
To copy to clipboard, switch view to plain text mode
In my case the copied_file_enc.ct is modified.
Bookmarks