exec
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 > exec




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

    exec  
friend_05


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


 
10-28-05 09:53 PM

I am using exec in following way.

execl("/usr/bin/cksum","/usr/bin/cksum",rfile,(char*)NULL))


But I want to store the output in file. Like I can do on command line (
cksum filename > tempfile).  How can I do this using exec.






[ Post a follow-up to this message ]



    Re: exec  
Ertugrul Soeylemez


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


 
10-28-05 09:53 PM






[ Post a follow-up to this message ]



    Re: exec  
Robert Harris


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


 
10-28-05 09:53 PM

friend_05 wrote:
> I am using exec in following way.
>
> execl("/usr/bin/cksum","/usr/bin/cksum",rfile,(char*)NULL))
>
>
> But I want to store the output in file. Like I can do on command line (
> cksum filename > tempfile).  How can I do this using exec.
>
You need to use popen.





[ Post a follow-up to this message ]



    Re: exec  
Mr. Uh Clem


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


 
10-29-05 10:51 PM

Robert Harris wrote:

> friend_05 wrote:
> 
> You need to use popen.

In this case, is there any need to make a child??
Why not just:

tfd=open("tempfile"...);
if (tfd != -1)
{
if (tfd != 1)
{
dup2(tfd, 1);
close(tfd);
}
execl(....);
}
..error...







--
Clem
"If you push something hard enough, it will fall over."
- Fudd's first law of opposition





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:01 PM.      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