[Gambas-user] reopen standard input

Robin Thompson robane00 at ...67...
Fri May 30 20:12:14 CEST 2008


Ok,

Anyone got any idea how to get EXEC .. for READ WRITE as x working?

So far i've got this (doesn't work at all)
FRONTEND is run from bash.  it sends the standard input to my test program (stdin) with echoes back it in uppercase

Frontend code:

PUBLIC SUB Main()

DIM a AS String
DIM t AS Process

t = EXEC ["stdin"] FOR READ WRITE AS "stdin"

PRINT #t, "this is a test"

WHILE NOT Eof(File.in)

LINE INPUT a
PRINT #t, a

WEND 
END


PUBLIC SUB stdin_read()
  
  DIM sLine AS String

  READ #LAST, sLine, -256
  
  PRINT #File.out, sLine
  
END
---------------------------------------------------------------------------------------------
stdin code:
PUBLIC SUB Main()
DIM a AS Integer
DIM inputline AS NEW String[]
DIM ipt, f AS String
PRINT #file.out, "teststring"

loo:
a = -1

WHILE NOT Eof(file.in)   
a += 1
inputline.Resize(a + 1)
LINE INPUT #file.In, inputline[a] 
WEND 


FOR EACH f IN inputline

PRINT #file.out, UCase(f)

NEXT 
WHILE Eof(file.in)
WEND 
GOTO LOO 

END
Thanks
RT
----------------------------------------
> From: sourceforge-raindog2 at ...94...
> To: gambas-user at lists.sourceforge.net
> Date: Fri, 30 May 2008 12:26:59 -0400
> Subject: Re: [Gambas-user] reopen standard input
> 
> On Friday 30 May 2008 11:05, nando wrote:
>> Perhaps using 2 programs.
>> The first is the pipe-to Gambas program.
>> It immediately starts another one which is your main
>> keyboard program. Then open a socket between the two so
>> the first can send info to the second.
> 
> I think the problem is on the sending end; once the input pipe is 
> closed, it's closed for all the programs in the pipe chain.  I just 
> tried this with Perl and the second program just immediately got EOF 
> as well.  I assume reading the tty/pty (whether directly or through 
> some library) is the only way this can reliably be done.
> 
> Rob
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

_________________________________________________________________

http://clk.atdmt.com/UKM/go/msnnkmgl0010000007ukm/direct/01/



More information about the User mailing list