//Sample Program to open a file from command line argument and send the output to the Printer #include < fstream.h > #include < process.h > void main(int argc, char *argv[]) { if (argc < =1) { cout << "\n\n Enter the file name "; exit (1); } ifstream infile(argv[1]); if (!infile) { cout << endl << "Can Not open the file" << argv[1]; exit(1); } char ch; ofstream outfile; outfile.open("PRN"); while(infile) { infile.get(ch); outfile << ch; } outfile.close(); }<< Go back.
Our aim is to provide information to the knowledge seekers.