Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-02-2007, 01:44 AM   #1
LQ Newbie
Registered: Mar 2007
Posts: 9

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


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, 02:37 AM   #2
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 199Reputation: 199

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

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



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 04:26 AM
C function to execute a program and return the output of the program ryan.n Programming 4 08-14-2004 10:11 PM
Is it possible to make a Linux server execute a program on a WinXP system? Cichlasoma Linux - General 4 04-23-2004 06:00 AM
System Calls file Hady Programming 1 12-13-2003 12:14 PM
want to execute a php file in a c++ program Mr_ss Programming 1 10-10-2001 03:15 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:16 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