Solved

Copy files in C++

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 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.

758 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

23 Experts available now in Live!

Get 1:1 Help Now