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

Demosthenes Koptsis demosthenesk at ...626...
Thu Sep 24 11:23:45 CEST 2009


in shell you can do it by

echo "Program started" >> /var/log/messages

note* >> means redirection to the end of file, so it is append

if you type > you will erase the contents of the file and put only
"Program started"

now you can use this command with SHELL.

On Thu, Sep 24, 2009 at 10:41 AM, Doriano Blengino
<doriano.blengino at ...1909...> wrote:
> Benoît Minisini ha scritto:
>>> these are shell commands, cat and echo
>>> cat shows the contents of a file and echo print a string in screen
>>> we use redirection which is >
>>> to a device printer /dev/lp0 or lp1 or lp2 see what is your printer
>>>
>>> To print a file you can write in shell or in gambas SHELL command the
>>>  command cat file > /dev/lp0
>>>
>>> there must be a file with name "file" which contains what you want to print
>>>
>>> or if you want to print a line straight use echo
>>>
>>> if you type in a console echo "test" you see in console the word test,
>>> so you redirect this to printer lp0 with this command
>>>
>>> echo "test" > /dev/lp0
>>> and you print it.
>>>
>>> try them fisrt from a console and then use them with Gambas SHELL or EXEC
>>>
>>>
>>
>> In Gambas, you can use PRINT instead of running a shell to run "echo"!
>>
>>
> This is true but... can I redirect output to every file I want using a
> simple one-line syntax?
> It could be interesting, as in the unix world everything is a file:
>
>    PRINT "Program started" TO "/var/log/messages"      ' append? or...
>    PRINT "Program started" APPEND "/var/log/messages"
>
> ...or something like that. Truth is that one can make a subroutine to do it.
>
> Regards,
> Doriano
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 

Γεια χαρα σε όλους!!!

Regards,

Demosthenes Koptsis




More information about the User mailing list