On 13/05/2010 14:16, Bob McConnell wrote:
From: robert Key
I want to capture UNBUFFERED output from a C programme and then
control it depending on its output. Problem is nothing seems to
unbufferd the output from the C programme. Only when the child has
finished executing do I get all the output which is too late.
The C programe is just like hello world in a loop of 20.
<snip>
I have tried all the recipes int the Perl cook book but none work.
The buffering is probably being done in the C runtime, so it isn't
sending any of the data until it closes. You need to check that code for
a way to disable output buffering.
Bob McConnell
The C programme looks like this (very simple)
#include <stdio.h>
int main()
{
int i;
char s[20] = "hello from c";
for (i = 0; i < 15; i++) {
sleep(1);
printf("%s %d\n", s, i);
}
return 0;
}
and yet I only get the output to perl when it is finished and died.
Thanks,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/