Date: Fri, 13 Oct 2000 13:55:10 -0700 From: Sriranga Veeraraghavan <ranga@CSUA.Berkeley.EDU> To: Johan Pettersson <pettersson.johan@spray.se> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: execv Message-ID: <200010132055.NAA17861@soda.csua.Berkeley.edu> In-Reply-To: Your message of "Fri, 13 Oct 2000 11:01:46 %2B0200." <Pine.BSF.4.21.0010131054320.84056-100000@ng4L117.i.spray.se\000>
next in thread | previous in thread | raw e-mail | index | archive | help
> I have problem with a C-program. > > -----8<------------------------ > char *arglist[] = { "-e pine" }; > . > . > execv("/usr/X11R6/bin/xterm", arglist); > -----8<------------------------ > > The function replaces the process image > with xterm. But how do I pass arguments > to xterm. (above doesn't work =( Hi, The man page sums it up pretty clearly. Here are the relavent parts: int execv(const char *path, char *const argv[]) The initial argument for this functions is the pathname of a file which is to be executed. The second argument provides an array of pointers to null-terminated strings that represent the argument list available to the new program. The first element of the array of pointers, by convention, should point to the file name associated with the file begin executed. The array of pointers must be terminated by a NULL pointer. You probably want to do something like: char *arglist[] = { "/usr/X11R6/bin/xterm", "-e", "pine", NULL }; ... execv (arglist[0],arglist); HTH, ----ranga To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010132055.NAA17861>