Output to a printer

D

dohboy

Hi,
I'm having a problem getting a program to print to my inkjet. I've tried addressing with lpt1, PRN and even USB001. It just doesn't seem to find it's way to the printer. Here's the code:

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

int main(void)
{
int x = 65534;
const double f = 3.1415;
char somename[10];

ofstream printer;
printer.open("USB001");
if (!printer) {
cout << "There is something dodgey with the printer.\n";
return 0;
}

cout<<"Enter a word (Max 9 chars): ";
cin.getline(somename,9, '\n');
printer << "The values are: " << x <<"\n" << f << "\n" << somename <<endl;

printer.close();
return 0;
}


Any ideas, anyone?

TIA
-doh

"Ooh! sensory depravation kicks ass! "
-The Prophet Homer
 
R

red floyd

dohboy said:
Hi,
I'm having a problem getting a program to print to my inkjet. I've tried addressing with lpt1, PRN and even USB001. It just doesn't seem to find it's way to the printer. Here's the code:

The C++ standard ISO/IEC 14882:2003 does not discus priting, lpt1, PRN,
or USB001. Try a newsgroup dedicated to your platform.

That said,
#include <iostream.h>
#include <fstream.h>
No such headers.

#include <iostream>
#include <fstream>
#include said:
int main(void)
{
int x = 65534;
const double f = 3.1415;
char somename[10];

ofstream printer; std::eek:fstream printer;
printer.open("USB001");
if (!printer) {
cout << "There is something dodgey with the printer.\n";
return 0;
}

cout<<"Enter a word (Max 9 chars): "; std::cout << ...
cin.getline(somename,9, '\n'); std::cin.getline
printer << "The values are: " << x <<"\n" << f << "\n" << somename <<endl; std::endl;

printer.close();
return 0;
}


Any ideas, anyone?

TIA
-doh

"Ooh! sensory depravation kicks ass! "
-The Prophet Homer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top