I'm making an GUI for a program to transfer files over USB to an ogg-player. When it transfers it show's the amount of bytes sent.
Code:
ruben@localhost Projects $ ./test.pl
2731363 sent.
as you see it shows all it's output on one line.
But when pipe the output of the program ( not my gui) to a file (like ifp upload>>foofile) I get all the lines separated:
0 sent
16 sent
43 sent
...
My main problem is to capture the output while the program is still transfering (since it's the only way to make an usefull progressbar
)
To get output I normally use
Code:
#!/usr/bin/perl -w
open(PROC,'ifp upload /home/ruben/test.mp3 test.mp3 |') || die;
while(<PROC>){
print $_;
}
close PROC;
But when I run this I only get the last line == useless
Anybody knows a way to capture my output while the program is transfering ?