M
MAx
Hi guys,
I am a c++ newbee and i am trying to write a file to a default
printer.
Please have a look at the code below and let me know if it'll work.
I know that similar code in C will work.
I was wondering how will the associated driver react.....
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char buffer[50];
ifstream inFile("print_data.txt", ios::in);
ofstream outFile("/dev/lp0",ios:ut);
if (!inFile){
cout << "Unable to open the file, print_data.txt"<< endl;
return 1;
}
if(!outFile){
cout << "Unable to open file, /dev/lp0" << endl;
return 1;
}
while (inFile >> buffer) // Copying data from text file
outFile << buffer; // Writing data to the Device file
inFile.close();
outFile.close();
return 0;
}
I am a c++ newbee and i am trying to write a file to a default
printer.
Please have a look at the code below and let me know if it'll work.
I know that similar code in C will work.
I was wondering how will the associated driver react.....
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char buffer[50];
ifstream inFile("print_data.txt", ios::in);
ofstream outFile("/dev/lp0",ios:ut);
if (!inFile){
cout << "Unable to open the file, print_data.txt"<< endl;
return 1;
}
if(!outFile){
cout << "Unable to open file, /dev/lp0" << endl;
return 1;
}
while (inFile >> buffer) // Copying data from text file
outFile << buffer; // Writing data to the Device file
inFile.close();
outFile.close();
return 0;
}