Solved

Copying a File in turboc c++3.00

Posted on 1998-11-22
3
194 Views
Last Modified: 2010-04-01
How to copy one file from one directory to another directory
through a program in turbo c++ 3.00 ?
Kindly reply fast as its very urgent.
Thanks.
0
Comment
Question by:nitin_kumars
3 Comments
 
LVL 10

Accepted Solution

by:
rbr earned 200 total points
ID: 1178416
Use the system command
system ("copy \\dir1\\file1 \\dir2\\file2");

0
 

Author Comment

by:nitin_kumars
ID: 1178417
The System Command does not work on the system. It Gives An error saying -1. It Was very quick of you to reply. Kindly reply soon again but with an example. I'll wait for the reply till late night so please be fast b'cos its very very urgent.
Thanx

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1178418
Is it for school or something?  Why do you need it so fast?

What operating system are you using?  DOS/Windows/Win95/98?  If it is any of those, the system command should work.  What is the value of the errno variable after you call system?

A return value of – 1 indicates an error, and errno is set to one of the following values:

E2BIG Argument list (which is system-dependent) is too big.

ENOENT Command interpreter cannot be found.

ENOEXEC Command-interpreter file has invalid format and is not executable.

ENOMEM Not enough memory is available to execute command; or available memory has been corrupted; or invalid block exists, indicating that process making call was not allocated properly.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 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.

747 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

12 Experts available now in Live!

Get 1:1 Help Now