Parallel port

Ned Konz ned at
Sun Apr 7 17:00:33 UTC 2002

On Sunday 07 April 2002 04:21 am, Bergel Alexandre wrote:

> There is a serial port pluging, and what about a parallel one ?
> So, actually, it is impossible to use a printer within Squeak.

Not at all. Typically (on most computers, anyway), there is a more or less raw 
interface to the printer port that acts like a file. On my Linux computer, my 
parallel port (the one that works with printers) is '/dev/lp0'. (there is a 
raw interface as well called '/dev/parport0' that might be more interesting 
if I were interfacing random hardware). On Windows a printer might be called 
'LPT1:' Assuming that the printer understands bytes you send to it (that is, 
if it is a PCL or Postscript printer, or understands raw ASCII), it will do 
something with those bytes. (Unfortunately, my printer is a "GDI" one that 
takes special byte codes to make marks on paper, so I can't test it very 
well, but...)

We should be able to open the printer port for write and write bytes to it (if 
nothing else has it open, and if we have rights to write to it). However, I 
can't seem to get it to work.

d _ FileDirectory on: '/dev'.
d fileExists: 'lp0'.            => true
f _ StandardFileStream new open: '/dev/lp0' forWrite: true.   => nil
f _ d fileNamed: 'lp0'   => nil
f _ d oldFileNamed: 'lp0'         => lp0 does not exist (!)

hmm... how do I open a write-only file?
Why aren't these things working?
Ned Konz
currently: Stanwood, WA
email:     ned at

More information about the Squeak-dev mailing list