C++ examples for File Stream:stream
Prints to the printer device
#include <fstream> #include <iostream> using namespace std; ofstream prnt; // Points to the printer. void main()/* w w w . j av a 2 s .c o m*/ { prnt.open("LPT1", ios::out); prnt << "Printer line 1\n"; // 1st line printed. prnt << "Printer line 2\n"; // 2nd line printed. prnt << "Printer line 3\n"; // 3rd line printed. prnt.close(); return; }