LinuxQuestions.org
Register a domain and help support LQ
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 05-02-2007, 02:44 AM   #1
psandeepnair1985
LQ Newbie
 
Registered: Mar 2007
Posts: 9

Rep: Reputation: 0
Question System calls/functions to execute a file within a program


Hi,

Is there any system call or library function using which we can execute a file and redirect its output to another file........Can i use execve family of functions for this purpose.If yes how?
 
Old 05-02-2007, 03:37 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,298

Rep: Reputation: 175Reputation: 175
language?

exec will replace the calling process.
Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    system("/bin/ls > out.log");

}
 
  


Reply


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
how to execute a .exe file in linux environment from a c program? aakanksh_c Linux - General 1 09-18-2005 05:26 AM
C function to execute a program and return the output of the program ryan.n Programming 4 08-14-2004 11:11 PM
Is it possible to make a Linux server execute a program on a WinXP system? Cichlasoma Linux - General 4 04-23-2004 07:00 AM
System Calls file Hady Programming 1 12-13-2003 01:14 PM
want to execute a php file in a c++ program Mr_ss Programming 1 10-10-2001 04:15 PM


All times are GMT -5. The time now is 09:42 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration