LinuxQuestions.org
Review your favorite Linux distribution.
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-04-2002, 03:16 PM   #1
rklosinski
LQ Newbie
 
Registered: Nov 2002
Posts: 8

Rep: Reputation: 0
Starting anther process


How can i start anther process (simular to shellexecute in win32) using C under Linux. I tried exec family, but they all remove the calling program from memory.
 
Old 12-04-2002, 03:34 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
man system

:)

Cheers,
Tink
 
Old 12-05-2002, 12:06 AM   #3
rklosinski
LQ Newbie
 
Registered: Nov 2002
Posts: 8

Original Poster
Rep: Reputation: 0
system() seams to work, but how can I monitor the process to know when its completed(?) i.e. get the process id
 
Old 12-05-2002, 12:21 AM   #4
Hans Zarkoff
Member
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 58

Rep: Reputation: 15
Do a 'man fork.' Fork() creates a child process, returns child PID. Sounds like exactly whacha need.
 
Old 12-05-2002, 12:31 AM   #5
rklosinski
LQ Newbie
 
Registered: Nov 2002
Posts: 8

Original Poster
Rep: Reputation: 0
fork will create a child process of the same process. i want to spawn anther (and different) process (program) from my application, then monitor it for completion.

Basically, i need a something simular to "ShellExecuteEx" in win32 that will work under linux.
 
Old 12-05-2002, 08:09 AM   #6
Malicious
Member
 
Registered: Jan 2002
Location: Galveston Island
Distribution: suse, redhat
Posts: 208

Rep: Reputation: 30
Did you read the man page for "system" as Tinkster suggested? The system() call does not return until the shell terminates and the int returned by system() will tell you the exit code of the program. This is true even if you put an "&" at the end of the command passed to system(). If you want to monitor the output (stdout) of the program, use popen().
 
  


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
Starting process on display :1 noware Linux - General 8 12-01-2005 06:52 AM
a questions about starting process fetsh Linux - Newbie 2 06-03-2005 07:42 PM
Starting a program with a given process id DropSig Linux - Newbie 1 09-29-2004 08:41 PM
K3B freezing when starting burn process Ian.hill Linux - Software 7 04-13-2004 06:11 AM
rsh starting a background process clockworks Linux - Software 0 03-04-2004 09:33 AM

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

All times are GMT -5. The time now is 01:52 AM.

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