daz wrote:

> [cc: email]
> 
> Roeland Moors wrote:
> 
>>>>Here is a simple ruby test program:
>>>>
>>>><-- CODE -->
>>>>#!/usr/bin/env ruby -w
>>>>
>>>>gnucap = IO.popen("gnucap", "w+")
>>>>output = ""
>>>>while output !~ /.*#{"gnucap>"}$/
>>>>    char = gnucap.getc.chr
>>>>    output += char
>>>>end
>>>>puts "ok"
>>>><-- CODE -->
>>>>
>>[...] I found a solution
>>I just send an extra empty command after each command.
>>
> 
> 
> Thanks for the feedback, Roeland.
> 
> Could you show a small example like your original one
> with the change you made, please ?
> 
> It may be useful to others with a similar problem
> and I might try it if I can get gnucap to compile
> with Borland 5.5.
> 

<-- CODE -->
#!/usr/bin/env ruby -w

gnucap = IO.popen("gnucap", "w+")
gnucap.puts "" # <--- Empty command
output = ""
while output !~ /.*#{"gnucap>"}$/
     char = gnucap.getc.chr
     output += char
end
puts "ok"
<-- CODE -->

The output is now:
<-- OUTPUT -->
gnucap>

gnucap>
<-- OUTPUT -->
I stop reading after the first "gnucap>"
When I want to read the output of the next command I first skip the 
extra "gnucap>"


I'm thinking of making ruby bindings for gnucap.
When I've got the basics working I will anounce it in this group and the 
gnucap mailinglist.


PS:
This is how I compiled MinGW under windows:

- Install mingw 3.1.0-1
- Install msys 1.0.10
- Download en extract gnucap 0.34
- edit the file "gnucap-0.34/src/Make2.mingw32" en change the compiler
   from "i586-mingw32msvc-g++" to "mingw32-c++"
- go to gnucap-0.34/src/ en type "make mingw"
- gnucap.exe is now in "gnucap-0.34/src/Msw/"

I don't know if this is the best method, but it works for me.

-- 
Roeland