Re: help with exec in glade



Thera are two way under UNIX / LINUX to execute

1) doing all code yourself using the fork() systemcall and the the 
NAME
       execl, execlp, execle, execv, execvp - execute a file
 
SYNOPSIS
       #include <unistd.h>
 
       extern char **environ;
 
       int execl( const char *path, const char *arg, ...);
       int execlp( const char *file, const char *arg, ...);
       int  execle( const char *path, const char *arg , ..., char
       * const envp[]);
       int execv( const char *path, char *const argv[]);
       int execvp( const char *file, char *const argv[]);   
   see documation 

2) using the system call this does fork() and exec stuff in one call
                   
SYSTEM(3)           Linux Programmer's Manual           SYSTEM(3)
 
NAME
       system - execute a shell command
 
SYNOPSIS
       #include <stdlib.h>
 
       int system (const char * string);
 
DESCRIPTION
       system() executes a command specified in string by calling
       /bin/sh -c string, and returns after the command has  been
       completed.   During execution of the command, SIGCHLD will
       be blocked, and SIGINT and SIGQUIT will be ignored.
 
RETURN VALUE
       The value returned is 127 if the execve() call for /bin/sh
       fails,  -1  if there was another error and the return code
       of the command otherwise. 

you can end the string with & so the call is asyncron your task and the
new will
both run othrwise the calling task waits until the second has finished,
no windows
refresch mouse movement is done, no very nice in X.

somtimes you have to allow your task to use your display  so you have to
use
          xhost +   see xhost manual

Best Regards 
Günther                                              
satyajit parekh wrote:

i need help desperately with the following problem

i have a  executable binary file which can be executed from command
line with a few command line arguments

it executes perfectly from command line

i created a interface using glade to obtain the values of these
parameters from the application user. on clicking a button OK the
values entered in the interface are passed to and stored as some
variables.

i need to execute the binary file with these arguments
from within the interface itself

i tried using
exec ("file-path-name", "arg1, arg2,..") in callbacks.c
it doesnt execute

can i use exec in this case? or is it some other func/syscall?
if yes which file do i add the "exec"command to ? is it main.c or is
it callbacks.c or someother file

please help

waiting for ur quick replies
thanx
sap

----------------------------------------------------------------------
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!

-- 
R=I+S  Rapp Informatik Systeme GmbH
       Rosenbühlstr. 24
       D-89182 Bernstadt
       Tel:  +49 (0)7348-7755
       Fax:  +49 (0)7348-6086
E-MAIL  mailto: guenther rapp-informatik de
WEB             www.rapp-informatik.de

Attachment: guenther.vcf
Description: Card for günther



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]