ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
My program is perlTK that allows the user to select an input file (text) and then it kicks off a series of 'C' programs that translate the input file to what is called 'ARPA' format. The program runs just fine but now I need to add some additional functionality ...
While the 'C' progs are running, they splash some progress (or failure) lines to the perl console (Gnome Terminal). I would like to save these progress lines in a file either real-time as they are being created or by somekind of copy-paste operation from the console to a file.
So far I tried standard redirect (>), STDOUT/STDERR (1>&2) maneuvers, Tk-ExecuteCommand and some other approaches I found in the user groups forums ... all to no avail as they all give me the full outputs of the 'C' programs which I already have. All I need to capture is the console text.
To be honest, I'm not even sure if this is a Perl problem, A TK problem, Bash problem or whatever.
Hmm, you may be right. If there are several programs all writing simultaneously, perhaps the best way would be to create a socket that all the programs can write to, a socket that is being monitored by the main program, which can then redirect all the output to one file (or wherever).
Sounds like the C progs are opening a separate filehandle to the console and printing to that.
Do you have access to the src?
Yes, I have access to the C source code. ALthough it is part of a dedicated 3rd-party toolkit, there is no harm in massaging the code to turn off the current output and write additional code to open an I/O stream to the file I need.