Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Output to a printer

Reply
Thread Tools

Output to a printer

 
 
dohboy
Guest
Posts: n/a
 
      03-08-2008
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
 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      03-09-2008
dohboy wrote:
> 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 <ostream>

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

std: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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shared printer not found in add printer wizard =?Utf-8?B?YW50aG9ueQ==?= Wireless Networking 0 10-31-2004 06:49 AM
xp pro, printer will not install, xp error: "operation could notbe completed" when clicking on add printer psion Computer Support 1 02-21-2004 12:48 AM
Force Printing to a printer based on the given printer name Samuel Lee ASP .Net 0 11-11-2003 03:07 AM
Adding the same printer twice in XP (copying printer) cromi Computer Support 2 10-23-2003 05:50 AM
Help - Xerox C15 Printer printer Tom Mix Computer Support 1 07-13-2003 04:20 PM



Advertisments