nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

how to Write Terminal command data into a file

This is a discussion on how to Write Terminal command data into a file within the Coding in General forums, part of the Development/Scripting category; Hi.. m trying to make a program in C which executes some command through system(). I want to write the ...


Go Back   nixCraft Linux Forum > Development/Scripting > Coding in General

Linux answers from nixCraft.


Coding in General Discussion on PHP/Perl/Python/Ruby/GNU C or C++. MySQL, PgSQL and (X)HTML or any other programming languages you want.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27-03-2009, 11:00 AM
Junior Member
User
 
Join Date: Mar 2009
OS: Red Hat
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vazzdoin is on a distinguished road
Default how to Write Terminal command data into a file

Hi..
m trying to make a program in C which executes some command through system(). I want to write the output of that command into a file and inspite of printing the output on the terminal. . How can i do it in C.
please give me some idea, n please send some example if u can ..
Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 27-03-2009, 04:30 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 246 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Have you tried out?
Code:
system("ls >output.txt");
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply

Tags
c program , c system() , gcc , linux c program


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Parse XML file and store data in array in shell scripting Nishanthhampali Shell scripting 6 15-12-2009 07:37 PM
Mounting a file server with data from a sql database. sempinsenzai File Servers 0 17-12-2008 05:20 AM
GDM could not write to your authorization file kami CentOS / RHEL / Fedora 0 07-05-2008 01:58 AM
Rearange Data from a file to another sebastanov Shell scripting 1 16-04-2008 10:46 AM
how to open an pdf file(.pdf) in terminal chandrasekar Getting started tutorials 1 27-03-2008 12:41 AM


All times are GMT +5.5. The time now is 05:12 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38