Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.222.78.65
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/rnlink/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/rnlink/mcp.cpp
//
//	Assignment 2
//
//	Author:		Raichel Link
//	Instructor:	Dr. Wang
//	Due:		Feb. 18, 2008
//
//	Goal:		Write a C++ program named mcp that will
//			implement the UNIX shell Command cp.
//
//	File name:	mcp.cpp
//	Compiling:	g++ mcp.cpp -o mcp.out
//	Excution:	./mcp.out
//

#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char* argv[])
{
	ifstream infile;
	ofstream outfile;
	char ch;

	if (argc <= 2)
		cout << "Not enough arguments. Requires two file 
names.\n";
	else if (argc >= 4)
		cout << "Too many arguments. Requires two file names.\n";
	else
	{	
		infile.open(argv[1]);
		outfile.open(argv[2]);
		infile.get(ch);	// priming read
		while(infile)	// EOF-
		{
			outfile.put(ch);
			infile.get(ch);
		}	
	}

	return 0;
}


Stv3n404 - 2023