Hello world/Line printer: Difference between revisions

From Rosetta Code
Content added Content deleted
(Basic task description)
(→‎{{header|PureBasic}}: Added PureBasic)
Line 11: Line 11:


<lang dos>ECHO Hello world!">PRN</lang>
<lang dos>ECHO Hello world!">PRN</lang>

=={{header|PureBasic}}==
{{libheader|PureLPRINT}}
<lang PureBasic>MyPrinter$ = LPRINT_GetDefaultPrinter()
If LPRINT_OpenPrinter(MyPrinter$)
If LPRINT_StartDoc("Printing a RC-Task")
LPRINT_Print(Chr(27) + "E") ; PCL reset for HP Printers
LPRINT_PrintN("Hello World!")
LPRINT_NewPage()
LPRINT_EndDoc()
EndIf
LPRINT_ClosePrinter()
EndIf</lang>


=={{header|Tcl}}==
=={{header|Tcl}}==

Revision as of 08:02, 3 October 2010

Task
Hello world/Line printer
You are encouraged to solve this task according to the task description, using any language you may know.

Cause a line printer attached to the computer to print a line containing the message Hello World!

BASIC

Works with: QBasic

<lang qbasic>LPRINT "Hello World!"</lang>

Batch File

<lang dos>ECHO Hello world!">PRN</lang>

PureBasic

Library: PureLPRINT

<lang PureBasic>MyPrinter$ = LPRINT_GetDefaultPrinter() If LPRINT_OpenPrinter(MyPrinter$)

 If LPRINT_StartDoc("Printing a RC-Task")
   LPRINT_Print(Chr(27) + "E") ; PCL reset for HP Printers
   LPRINT_PrintN("Hello World!")
   LPRINT_NewPage()
   LPRINT_EndDoc()
 EndIf
 LPRINT_ClosePrinter()  

EndIf</lang>

Tcl

On Unix only: <lang tcl>exec lp << "Hello World!"</lang> or <lang tcl>set f [open |lp w] puts $f "Hello World!" close $f</lang> On Windows only: <lang tcl>set f [open prn w] puts $f "Hello World!" close $f</lang>

UNIX Shell

Works with: Bourne Shell

<lang bash>echo 'Hello World!'|lp</lang>