in reply to Get output after running IPC::Run

You are probably suffering from buffering. Most implementations use line-buffering, so the buffer will not be flushed from C without the "\n".
In Perl: local $|=1; or in your C: fflush(stdout);

Replies are listed 'Best First'.
Re^2: Get output after running IPC::Run
by pid (Monk) on Nov 23, 2009 at 11:45 UTC

    Hi cdarke,
    I've already added those to both of my programs, but the trick didn't work.

    More details: my Perl script is running under mod_perl2, what the script do, is accepting C source code uploading
    and compile & run it on-the-fly, send the input to the generated executable through ``$in'' and grab the output via ``$out''.

    The only problem I have is I can't get the output without the "\n", so I was wondering if there's a way to do it.

    To Khen1950fx, thanks for the response.

    I've submitted my reply many times but failed in this afternoon...

      accepting C source code uploading and compile & run it on-the-fly

      I sure hope there's some kind of sandbox. It wouldn't take very many lines of C to ruin your whole day.

        Yes it is.

        We are planning to replace the old one built up on C and couple of shell scripts, some funny guys suggest rewriting it in .NET (also other languages)
        and I told them I could write this in a few lines of Perl...so I just did it...