Solved

Copy files in C++

Posted on 2000-03-08
2
410 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c++ mixing int and strings in multi array 8 71
Grammars for C C++ and java 1 113
VS2015 compilation and missing DLLs 9 114
thread-safe code in c++ 2 83
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

932 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now