Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy file to new directory

Status
Not open for further replies.

japhy

Programmer
Sep 27, 2004
12
US
hi there,

i'm fairly new to C++. I'm just trying to write code
that will copy a file to a new directory with a different name. I was trying to use CFile read and write commands but i can't seem to get the data from one file to appear in the other.

any suggestions are really appreciated.
thanks
 
You could use the Win32 API calls: ReadFile, and WriteFile, both have great documentation on
ORRR you could do it the 'hard' way, and use the ifstream and ofstream objects, input file stream, and output file stream, read one file, write it out to another. :)

while( !inFile.eof() )
{
inFile.getline( //string buffer, etc etc. );

outFile.write( //stringbuffer, etc etc );
}

The weevil of doooooooooom
-The eagle may soar, but the weasel never gets sucked up by a jet engine (Anonymous)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top