Roxanne_Hayling
asked on
C++ Program for copying files
I have an exam and need a simple progam to copy from one file to another in c++ program
I also have to open and close the file
I also have to open and close the file
Sorry, we can't do homework, but if you can post a first stab at the code, we can help out..
Just like you have to open a book to read or write in it, and you close it when you're done, you do the same thing with files.
To push the metaphor even further, if you're hand copying a book, you might copy one line at a time.
Have you tried surfing for sample code?
To push the metaphor even further, if you're hand copying a book, you might copy one line at a time.
Have you tried surfing for sample code?
This may help you get started:
http://www.gsys.biz/Documents/Downloads/CityAndGuilds/7261-229/SimpleInputAndOutput.rtf
Get the article and look at the File Handling entry:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2486&lngWId=3
http://www.gsys.biz/Documents/Downloads/CityAndGuilds/7261-229/SimpleInputAndOutput.rtf
Get the article and look at the File Handling entry:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2486&lngWId=3
The process is to open the file in binary mode, read it an write it the target. I guess I shouldn't send you the code
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Uh, folks, I seriously doubt that this elementary assignment has anything to do with binary files.
Its true that it does not directly deal with binary files, but opening the file in a binary mode will give a more generalised approach
One byte at once is easy to implement but it is slooooow. If you read blocks (I use 1024 bytes) the transfer rate will fly up into the sky!!!
You can also use "Scripting.FileSystemObjec t" object for copying file.
FileSystemObject can be used for all file operations. no need of binary file copy.
find out if you can use this object in C++. Check for any such libraries
FileSystemObject can be used for all file operations. no need of binary file copy.
find out if you can use this object in C++. Check for any such libraries
death_befo_dishonor should earn the points