Hi all

I am a noob to C++ and I want to make a program that copies a file from wherever previously specified to the location of where the program is running from, I looked on google but I cant find anything I can understand can somebody please point me in the right direction. I would be very grateful.


Many thanks

HLA91

Recommended Answers

All 3 Replies

CopyFile, perhaps? Or you could just read the file into memory, and write it back into a new file.

How would I read it into memory and so on I have never heard of that?

Open the input file with ifstream. Open the destination file with ofstream. Then use rdbuf(),

outputFile << inputFile.rdbuf();

Naturally, you'll still have to implement error-checking.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.