C++ Programming Blog

 
 
 
 #include<iostream.h>
 #include<fstream.h>
 #include<stdlib.h>
 #include<conio.h>

 main(int argc,char *argv[])
    {
       clrscr();

       if(argc!=2)
      {
         cout<<\"\\n Format : File - Print File Name \"<<endl;
         exit(0);
      }

       char ch=\'\\0\';

       ifstream input_file;
       ofstream output_file;

       input_file.open(argv[1]);
       output_file.open(\"PRN\");   // or LPT1

       while(input_file.get(ch)!=0);

       output_file.put(ch);

       getch();
       return 0;
    }

 
 
Didn't find what you were looking for? Find more on Program to illustrate printing data on the printer