On dimanche 12 octobre 2008, Doriano Blengino wrote: > Kari Laine ha scritto: > > 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. > > If you look carefully at the docs about EXEC: > > [ _Process_ *=* ] *EXEC* _Command_ [ *WAIT* ] [ *FOR* { { *READ* | > *INPUT* } | { *WRITE* | *OUTPUT* } } ] [ *AS* _Name_ ] > > you'll notice that you can't specify both READ & WRITE --------^ > > I have also a big book about Linux programming and, when I first read > that book, I was wondered because it said that you can't open a pipe > both for reading and for writing. Doing such things is a completely > different matter, it said. > Still I think that it should be possible with the right calls but, don't > knowing what gambas does behind the scenes, the only thing I can say > now, is that the syntax explanation does not permit that. But gambas > happily lets you specify both READ & WRITE...
Guess what: Gambas internally uses -two- pipes. One for reading the process output, and another for writing to it. Of course only one pipe is used if you specify only READ or WRITE. > > Then, reading more carefully, I noticed that the docs say: "if you > specify INPUT & OUTPUT instead of READ & WRITE, then the process is > executed inside a virtual terminal". Remembering that that book was > talking, if I well remember, about virtual terminals to be necessary to > do such things, I tried in gambas. And it works! I'm happy to know that. :-) This feature is needed, because many command-line tools need to be run inside a terminal to be really useful. Regards, -- Benoit Minisini ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user