View Single Post
  #4 (permalink)  
Old March 30th, 2004, 01:12 PM
davekw7x davekw7x is offline
Authorized User
 
Join Date: Feb 2004
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote