LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-17-2003, 04:16 AM   #1
CrazyDragon
LQ Newbie
 
Registered: Dec 2003
Posts: 1

Rep: Reputation: 0
Unhappy Can I put execl command output into a file?


I have a problem. I need to put the output from vmstat into a file, however vmstat doesn't want to go into a file!

Ok, I use execl("blah", "blah", blah) to get vmstat to output to the screen, but no such luck when I try using fprintf(in, "", (execl(...))) on the crazy m.f. I'm finding myself rather annoyed now (understatement of the year), and was wondering if anybody could shed some light on the situation.

Thanks
 
Old 12-17-2003, 04:34 AM   #2
Tarts
Member
 
Registered: Feb 2003
Distribution: Slackware 9.1 (exclusively) ;)
Posts: 344

Rep: Reputation: 30
Try:

Code:
execl("/bin/bash", "bash", "-c", "/usr/bin/vmstat > /file.txt", NULL);
Tarts

{edited}

Last edited by Tarts; 12-17-2003 at 04:43 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Output the result of a command to a file darkarcon2015 Linux - Newbie 1 09-24-2005 06:29 PM
Command line to get output on a file satimis Programming 4 06-24-2005 06:04 AM
how to use the output of a file for input of a command sneak Linux - General 2 05-12-2004 09:21 AM
execl on a script file iasion Linux - General 1 03-25-2004 06:40 AM
Help: Command Output to File. rvijay Linux - Newbie 3 09-30-2003 09:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration