Newbie question on writing data to two outputs
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Newbie question on writing data to two outputs




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Newbie question on writing data to two outputs  
philbo30


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 06:18 AM

Kind of a C / Linux question all in one; I hope this is the right
group. This is more of an "approach" question than a code question.
System is RH 7.3 with gcc 2.96

Currently I'm redirecting stdout to /dev/ttyS0 with freopen() in order
to write data to a kiosk printer. However, I also need to capture some
of that data so that I can simultaneously write it to a mysql database
immediately after (or immediately before) the ttyS0 output.

One approach is just to run through the full app twice, changing the
output function on the 2nd
run. That sounds way too intensive, so I'm hoping perhaps there's some
sort of "simultaneous" write function.  Generally speaking, what's the
best approach to this?

In advance, thanks for a pointer in the write direction.

-P3






[ Post a follow-up to this message ]



    Re: Newbie question on writing data to two outputs  
philbo30


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 06:18 AM

On May 17, 9:55 pm, philbo30 <masfe...@gmail.com> wrote:
> Kind of a C / Linux question all in one; I hope this is the right
> group. This is more of an "approach" question than a code question.
> System is RH 7.3 with gcc 2.96
>
> Currently I'm redirecting stdout to /dev/ttyS0 with freopen() in order
> to write data to a kiosk printer. However, I also need to capture some
> of that data so that I can simultaneously write it to a mysql database
> immediately after (or immediately before) the ttyS0 output.
>
> One approach is just to run through the full app twice, changing the
> output function on the 2nd
> run. That sounds way too intensive, so I'm hoping perhaps there's some
> sort of "simultaneous" write function.  Generally speaking, what's the
> best approach to this?
>
> In advance, thanks for a pointer in the write direction.
>
> -P3

Nevermind; solved my problem with fprintf()






[ Post a follow-up to this message ]



    Re: Newbie question on writing data to two outputs  
Maxim Yegorushkin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 12:20 PM

On 18 May, 02:55, philbo30 <masfe...@gmail.com> wrote:
> Kind of a C / Linux question all in one; I hope this is the right
> group. This is more of an "approach" question than a code question.
> System is RH 7.3 with gcc 2.96
>
> Currently I'm redirecting stdout to /dev/ttyS0 with freopen() in order
> to write data to a kiosk printer. However, I also need to capture some
> of that data so that I can simultaneously write it to a mysql database
> immediately after (or immediately before) the ttyS0 output.
>
> One approach is just to run through the full app twice, changing the
> output function on the 2nd
> run. That sounds way too intensive, so I'm hoping perhaps there's some
> sort of "simultaneous" write function.  Generally speaking, what's the
> best approach to this?
>
> In advance, thanks for a pointer in the write direction.

A couple of pointers:
http://www.die.net/doc/linux/man/man1/tee.1.html
http://www.die.net/doc/linux/man/man2/tee.2.html






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:20 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register