You are here:

C++/Question in c++


I am biginner in C++, so please help,My question is

Que:  :  Write a program that emulates the DOS COPY command i.e., it should copy the contents of a character file (such as any CPP file) to another file. Invoke the program with two command line arguments the source file and the destination file like this

C>ocopy srcfile.ext   destfile.ext

In the program check that user has typed the correct number of command line arguments, and that the file specified can be opened. Improve on the DOS TYPE command by having the program signal an error if destination file already exist. This will prevent inadvertently writing over a valuable file.  

1. copy contents: File IO: See For copying non-text files (like .exe etc) use binary mode.
2. command line arguments: See and
3. File exists or not:

Hope this helps.


All Answers

Answers by Expert:

Ask Experts


Amit Kumar


I can answer Cplusplus language and library questions, including STL, ACE, Boost. I have a good background in Mathematics.


Programming in CPP for about 8 years. Industry experience of 4 years.

Bachelors and Masters in Computer Science from Indian Institute of Technology Delhi.

©2017 All rights reserved.