Solved

Copy files in C++

Posted on 2000-03-08
2
420 Views
Last Modified: 2012-06-27
How do I copy a file from a certain location on one harddisk to another?
I would like to have the answer with both a way to copy from drive c: to drive d: and a way to copy from drive c: to an UNC-path, for example \\ns\c$
or \\ns\test
0
Comment
Question by:TFreak
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 70 total points
ID: 2597975
I assume this is for windows right?

Then use the CopyFile() windows api function.

example follows.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2597994
CopyFile("C:\\TEST.TXT","D:\\TEMPDIR\\TEST.TXT",TRUE);

CopyFile("\\ns\c$","C:\\WINDOWS\C$",TRUE);

Let me know if you have any questions.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question