Solved

Copy files in C++

Posted on 2000-03-08
2
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

623 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