C++ ofstream open("PRN") output to printer

Description

C++ ofstream open("PRN") output to printer

#include <fstream>
using namespace std;
int main()// www . j  a va 2s.  co  m
{
   char* s1 = "\nToday's winning number is ";
   int   n1 = 17982;
   ofstream outfile;              //make a file
   outfile.open("PRN");           //open it for printer
   outfile << s1 << n1 << endl;   //send data to printer
   outfile << '\x0C';             //formfeed to eject page
   return 0;
}



PreviousNext

Related