[Gambas-user] How to sent a line line to a lp1 printer and form to lp0 printer directly.

Vassilis K vkan53 at ...2300...
Thu Sep 24 13:12:49 CEST 2009


Thank you all for your help.

I have tried the following printing SUB:

PUBLIC SUB bEktiposi_Click()
	DIM hPrinter AS Printer
	DIM hFile AS File
	hPrinter = OPEN "dev/lp1" FOR OUTPUT
	hPrinter.EndOfLine = gb.Windows
	PRINT #hFile, "test a line: ";
	CLOSE hPrinter
END

It is compiled but it stops when bEtiposi Button is clicked
at line :
hPrinter = OPEN "dev/lp1" FOR OUTPUT
with the message:
" Access Forbidden. "

I have tried to print from terminal with commands
echo -e "Hello World\r" > /dev/lp1 
cat /etc/passwd > /dev/lp1
They have both worked only with root terminal.

First question:
How exactly can I put echo into SHELL command of Gambas?

Second question:
I suppose that's the reason why the routine OPEN "dev/lp1" .... is not 
working. It needs root privileges! 
Is there any other way to setup the printer /dev/lp1 in order to work with 
simple user privileges? 




More information about the User mailing list