On 10/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I wrote a shell script test.sh :
>
> while true
> do
> printf "test\n"
> sleep 1
> done
>
> Then I wrote a C program test.c that does exactly the same :
>
> test.c
> int main(void)
> {
> while(1)
>   {
>   printf ("test\n");
>   sleep(1);
>   }
> }
>
>
> ./test.sh | dzen2 -p     --> works
> ./test | dzen2 -p        --> doesn't work  (nothing in the dzen bar)
>
>
> Any help appreciated..
>

Have you tried forcing line buffering on stdout in the C program?
::

  int main(void)
  {
  setvbuf(stdout, NULL, _IOLBF, 1024);
  while(1)
    {
    printf ("test\n");
    sleep(1);
    }
  }

More on C buffering:

  http://www.gnu.org/software/libc/manual/html_node/Controlling-Buffering.html


--
Riccardo

http://chargen.blogspot.com/
http://alienamente.blogspot.com/

Reply via email to