how to print in c++

Jan 23, 2010 at 7:41am
I have been searching around on the web for a long time and can't find out how to print using c++. Although there are some pages explaining how to do this, but they are complex, a lot of them using graphics. I just wan't to print plain text. As i'm writing a cash regiter program and want to be able to print reciepts.
please note im not using a ltp printer im using a networked one
Jan 23, 2010 at 9:35am
Just blit to the printer DC
See all the MSDN samples and the well-known KB code in C which does exactly that.
(capture and print...)
Jan 23, 2010 at 9:57am
can you give me some example code of how to do this, im a beginner
Jan 23, 2010 at 12:53pm
u may connect ur stream object to the printer^^...
Jan 27, 2010 at 7:29pm
cout prounounced (see-out) is the print command. I believe you can only use this when u call the iostream in ur header. so for example

#include <iostream>
using namespace std;

int main() {
int x = 5
cout<<"Hello World"<<" I just went down a line with the following two characters\n";
cout<<x<<" "<<"Printed out variable x"<<endl;
}

you need to add endl at the end to print out everything.
Last edited on Jan 27, 2010 at 7:34pm
Jan 27, 2010 at 7:32pm
cout usually prints on the terminal emulator, the OP is asking for printing with a printer
Jan 27, 2010 at 8:24pm
i knew how to connect the cout to the printer... but since my book got lost and i never used this (only once for testing issues) i forgot that detail...

but i did try to google it and there are a lot of examples that work other ways...

ill try to figure out the easy way again...
Jan 31, 2010 at 10:30am
Topic archived. No new replies allowed.