Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-17-2003, 05:16 AM   #1
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.

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

Rep: Reputation: 30

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


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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:29 PM
Command line to get output on a file satimis Programming 4 06-24-2005 07:04 AM
how to use the output of a file for input of a command sneak Linux - General 2 05-12-2004 10:21 AM
execl on a script file iasion Linux - General 1 03-25-2004 07:40 AM
Help: Command Output to File. rvijay Linux - Newbie 3 09-30-2003 10:02 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:20 PM.

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