[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

print to different ports(lpt1,lpt2,lpt3....)

Could not find a right place to ask this, so since I a need to do this in c++ , then I ask here....sorry.

I need to send output to different parallel ports for printing. stdprn is mapped to LPT1, how can I print in c++ to LPT2, LPT3, and so on...
0
migue
Asked:
migue
  • 2
1 Solution
 
chensuCommented:
What operating system?
0
 
nietodCommented:
Just open them like a file.

ofstream LPT2("LPT2");

LPT2 ,<< "This Is a Test" << endl;
0
 
migueAuthor Commented:
this solution is for a dos-protected program running on plain dos and any version of windows.
0
 
nietodCommented:
Then just open the printer port as a file.  You can use an output file stream as  I showed you above.  Or you can use the C file I/O functions (fopen(), fwrite(), fclose()) or you can even use the DOS service interrupts.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now