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

Stefano Palmeri rospolosco at ...152...
Thu Sep 24 12:28:13 CEST 2009


Il giovedì 24 settembre 2009 12:10:50 Doriano Blengino ha scritto:
> 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
>
>
>
> ---------------------------------------------------------------------------
>--- 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

Another way to append a line wothput "echo >" or SHELL 
or OPEN is:

File.Save(User.home &/ "test", File.Load(User.home &/ "test") & "\nhello")

This append "hello" to file "test" in user home.
File "test" must exist.

Stefano




More information about the User mailing list