http://www.perlmonks.org?node_id=620734


in reply to Re: Inline: where did the output go?
in thread Inline: where did the output go?

Hi cdarke,

I'm trying to work up a minimal example to show the problem - the issue I've got now is that when I make the example very minimal, the problem goes away. :)

You may be right that it's a buffering problem though: I've written an example script which prints a line from Perl, then a line from C, then a line from Perl. On my Mac the lines appear in the file in the expected way, but on the Linux machine where I've originally found the problem, they appear in this order:
1 Perl
3 Perl
2 C
(should be 1 Perl, 2 C, 3 Perl)

and putting a fflush(stdout) in the right place solves that problem...

...ok, so let's try doing that in the real script... success! Hooray!

Triple++ (if I could) to cdarke, and many thanks.

Best wishes, andye

Replies are listed 'Best First'.
Re^3: Inline: where did the output go?
by Anonymous Monk on Jun 12, 2007 at 14:36 UTC
    Hummm. Not sure I deserve that. The buffer should be flushed on exit from the program, regardless of whether it goes to the screen or a file.
      Ah, but (and I should maybe have mentioned this before) the process runs for a long time, i.e. a couple of days.

      It's a long batch-processing job. (That's why I'm using Pdlpp to code part of it, because I need to get up to C speed otherwise it takes forever).

      So,
      - need to get output during the program run, as the point of the output is to show progress.
      - when I've been testing it to see if anything was showing up in the output file, I've been waiting a while and when nothing appeared I've been killing the process.

      Best wishes, andye