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

Doriano Blengino doriano.blengino at ...1909...
Thu Sep 24 12:10:50 CEST 2009


Demosthenes Koptsis ha scritto:
> 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.
>   
Thank you.
I was pointing out to Benoit that invoking SHELL to run a /bin/echo, 
which could seem stupid at first, it is not so stupid because in a 
single line you do what gambas would do in three lines. So, it could be 
nice to have something similar native in gambas, because in unix 
everything is a file. I suspect that this feature would be useful only 
in a few situations, so one can well write a subroutine to do that, but 
anyway I tried to think at a possible syntax: PRINT/TO, or PRINT/APPEND. 
It's funny to invent these things... Writing a subroutine has the 
disadvantage that every functionality has the same syntax. Look at what 
is clearer:

    print "Started" to "/var/log/messages"              ' good and clear 
syntax
    myappend("/var/log/messages", "Started")        ' much less readable

or, on the wave of these new stupid languages:

    Os.FileSystemUtilities.AppendStringToFile("/var/log/messages", 
"Started");

Note that in the myappend() call you don't know, at first, if "Started" 
is appended to /var/log/messages, or "/var/log/messages" is appended to 
./start. Then you go to the declaration to check this... where is the 
declaration in a big project having tenth of sources? I agree that 
choosing good names for identifiers is a must, but there could be 
something better.

Regards,
Doriano






More information about the User mailing list