|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Running an executable file
I've created a c program and compiled it with gcc, in unix.
The file name is abc.c and it is run by typing the command ./abc I have another program which creates a child process, and I need this abc program to run on that child process. I've tried execvp(), but it doesn't work. How can I run such a file on a child process? |
| Sponsored Links |
|
|
|
|||
|
Code:
#define PNAME "/fullpath/to/abc"
#define ARGS NULL
...
int status;.
if ( (child = fork()) == 0) {
execl(PNAME,basename(PNAME),ARGS);
} else {
waitpid(child,&status,0);
/*test for exit status of child process here with the WIF macros if important*/
} |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can i read a non text file in unix - ELF-64 executable object file - IA64 | alexcol | UNIX for Advanced & Expert Users | 8 | 11-07-2008 08:56 AM |
| Executable file | tonet | Shell Programming and Scripting | 3 | 01-17-2008 12:03 PM |
| file with executable permission | anent | UNIX for Dummies Questions & Answers | 9 | 11-13-2001 05:31 PM |
| update executable file | anent | Programming | 3 | 10-19-2001 04:40 PM |
| Newbie question about difference between executable file and ordinary file | Balaji | UNIX for Dummies Questions & Answers | 1 | 11-29-2000 06:49 AM |