You can't do it using strings, since strings work on characters with
certain rules that make it impossible to process files that have
white space and certain control characters.
I suggest you use obj1.read(filedata, sizeof(filedata)) to get the
entire file into the array. Note that since the maximum file size
will be something like 263 bytes (I think), you should declare the
filedata array to be larger than that.
After the obj1.read(), the number of bytes that were read can be
found by the gcount() function:
num_bytes = obj1.gcount();
(where num_bytes is an int)
Now, you have everything in the array, so you can write whatever
you want to obj2.
Does this help?
Regards,
Dave
|