paulojrudi 0 Newbie Poster

<<split from here>>

If all you want is teletype output (like you get on the console, without any fancy graphics or fonts or etc) you can open the PRN or LPT1 device:

#include <fstream>
#include <iostream>
using namespace std;

int main()
  {
  ofstream printer( "prn" );

  if (!printer) 
    {
    cout << "fooey!\n";
    return 1;
    }

  printer << "Hello world!\n";

  printer.close();
  return 0;
  }

Most PC printers that I know of can handle simple TTY output of this kind. If you open in binary mode you can also send printer control codes (specific to your printer) to program it.

Have fun!

Ok, but how can i point to the USB port? I tried:

ofstream printer( "usb001" );

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.