how to print in c++

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
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...)
can you give me some example code of how to do this, im a beginner
u may connect ur stream object to the printer^^...
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
cout usually prints on the terminal emulator, the OP is asking for printing with a printer
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...
Topic archived. No new replies allowed.