in reply to Pipe Problem

Not sure if this will help or not, but I had a similar problem a few years ago. On that occasion the progress message included a reference to a filename supplied via the command line. I discovered that by supplying a filename with a whole bunch of trailing spaces, it didn't affect the programs ability to open the file, but when it displayed the message it incorporated the trailing spaces. By adding enough spaces, it cause the pipe buffer to fill and so be output.

It doesn't look from your example that any of the parameters are paths, but if any of them are displayed as part of the progress message, you might try something like:

$data1 = sprintf "./myC.exe 10 10 1 \"abc%s\"", ' ' x 4096;

or even, if the executable name is part of the message:

$data1 = sprintf "%smyC.exe 10 10 1 abc", './' x 2048;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Pipe Problem
by Anonymous Monk on Jul 22, 2007 at 22:22 UTC
    Thank you for your response. I can modify the C program to output the trailing spaces. Is there a way I can find out how big my system's buffer is so I can output the necessary trailing spaces?

      Sorry. I assumed that you did not have the source to the C program. If you can modify the source, you should be able to call the C function flush() (or fflush()) on stdout/stderr after printing each progress message.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        No, the C program is working correctly. If I run it from the command line without calling it from PERL, it see the percent completed being printed to the screen as the C program progressed. +::010 (some times later) +::020 +::030 +::040 +::050 +::060 +::070 +::080 +::090 +::100 However, when I run the Perl script and invoking the C program from withing PERL, all the above lines get printed out at the same time after the C program are done. I can monitor this because I have another terminal connected to the database where the C program are sending requests and only when the C program have finished all its requests and disconnected after a few hours do I see all the above lines get printed to the screen all at once.