[Gambas-user] Help with SHELL and EXEC

Kari Laine klaine8 at ...626...
Sat Oct 11 21:58:51 CEST 2008


On Sat, Oct 11, 2008 at 12:02 PM, Olivier Cruilles <linuxos at ...1896...
> wrote:

> Hello,
>
> Maybe sommethink like that,
>
> cd /var/spool/news; tar cf - ./* |  gzip -c > files.tar.gz ;   echo
> "files.tar.gz" > filelist ; genisoimage -o img.iso -path-list filelist
>
> But if the name of the 'files.tar.gz' doesn't change, you can do it
> before this command one thing.
>
> Yep that's about the way I am going to do it - thanks.

I got interested this writing process input thing. I can read process output
without problem. Although it seems that reading of the stdout will start
only when process ends. I made a little filter program in C and a gambas
project to try to use it but I can not get the wrriting work so that when
written the filter would return something to gambas-project. This got to do
something that same program cannot both write and read to process - or what?
Well here they are if someone is also interested to test. I would be very
great full for any advice how to write to certain process.


program1.c
-------------------
#include <stdio.h>

int main()
{
int character;
int lask;

printf("program started\n");

character = getc(stdin);


        while(character != EOF)
        {
        //printf("%d",character);
        putc(character,stdout);
        character = getc(stdin);
        }

}
----------------------


Gambas
----------------------
' Gambas class file
PUBLIC nProcess AS Process
PUBLIC sOutput AS String

PUBLIC SUB Button1_Click()
  nProcess = EXEC ["/home/kari/gb_shell/program1"] FOR READ WRITE AS
"Contents"
END

PUBLIC SUB Contents_Read()

  DIM sLine AS String

  READ #LAST, sLine, -256
  PRINT sLine

  sOutput &= sLine

END

PUBLIC SUB Contents_Kill()

  PRINT "somebody killed me!"

END



PUBLIC SUB Button2_Click()

  WRITE #nProcess, "Input to process stdin"

END
-----------------------------

Best Regards
Kari Laine



More information about the User mailing list