IGNOU - Indira Gandhi National Open University, IGNOU Papers, IGNOU Assignments, IGNOU Results, University, Books, MBA, MCA, Exams, Delhi, India, Course, BCA, Bsc, Msc
 
Google
 
Home IGNOU Papers IGNOU Assignments IGNOU Students Forum IGNOU Articles Indian Education     Registration Login
Indira Gandhi National Open University IGNOU Indira Gandhi National Open University
IGNOU Latest Assignments
IGNOU BCA Assignments BCA 2009
IGNOU BCA Assignments BCA 2008
IGNOU BCA Assignments BCA 2007
IGNOU BCA Assignments BCA 2006
IGNOU Latest Assignments
IGNOU BCA Assignments IGNOU BCA Assignments
IGNOU BCA Assignments IGNOU MCA Assignments
IGNOU MBA Assignmants IGNOU MBA Assignments

IGNOU > IGNOU Assignments > BCA > BCA 2007 Assignments >C++ and Object Oriented Programming

IGNOU BCA Assignments

Question 1: 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 (Hint: Use no replace flag)


Ans:

The following example demonstrates those concepts. This is program which copies the data from one file and copies it to another the program receiving the @ names of the files as command file arguments

# include <Fstream.h>
void main (int, args, char * args [ ] )
{
if (args !=3)
{ int << the no. of arguments should be 3”;
return;
}
if stream real (args [1] );
if stream write (args [2]);
char c;
while (read get (c) write put (c);

PREVIOUSINDEXNEXT

Indira Gandhi National Open University   Indira Gandhi National Open University

HOME  |   ABOUT US  |  GUEST BOOK | TERMS OF SERVICE | PRIVACY POLICY | CONTACT US

© 2003-2012, IGNOUGuess.com

Website Designing, Website Development, Search Engine Promotion, Web Hosting By: DreamzSop Advertising Private Limited.