Printing to USB printer in Windows2000

I have been printing to a HP printer in windows2000 using
$stdout = File.open(“LPT1”, “W”)
print “Line 1 \n”

I can even control the HP deskjet using Ascii control codes. I just
got a new printer that interfaces using a USB port and is USB001 on the
system. Replacing LPT1 with USB001 does not work. Any ideas?

Norman Belssner wrote:

I have been printing to a HP printer in windows2000 using
$stdout = File.open(“LPT1”, “W”)
print “Line 1 \n”

I can even control the HP deskjet using Ascii control codes.

By Win2K, that’s probably a gruesome hack for backwards compatibility
with DOS programs that translates that to the proper driver calls. It’s
improbable that you’re actually talking to the printer directly.

I just got a new printer that interfaces using a USB port and is USB001 on the system. Replacing LPT1 with USB001 does not work. Any ideas?

For the quick hacks, write stuff to a temp file and do system(“print
path\to\file”). For the less hacky version, use the bindings to the
Win32API, or use a GUI toolkit - those tend to feature print support.

David V.