From owner-freebsd-questions Fri Oct 13 13:55:18 2000 Delivered-To: freebsd-questions@freebsd.org Received: from soda.csua.Berkeley.edu (soda.CSUA.Berkeley.EDU [128.32.43.52]) by hub.freebsd.org (Postfix) with ESMTP id 6FA4D37B503 for ; Fri, 13 Oct 2000 13:55:15 -0700 (PDT) Received: from soda.csua.Berkeley.edu (localhost [127.0.0.1]) by soda.csua.Berkeley.edu (8.8.8/) via ESMTP id NAA17861; Fri, 13 Oct 2000 13:55:11 -0700 (PDT) env-from (ranga@CSUA.Berkeley.EDU) Message-Id: <200010132055.NAA17861@soda.csua.Berkeley.edu> To: Johan Pettersson Cc: freebsd-questions@FreeBSD.ORG Subject: Re: execv In-Reply-To: Your message of "Fri, 13 Oct 2000 11:01:46 +0200." Date: Fri, 13 Oct 2000 13:55:10 -0700 From: Sriranga Veeraraghavan Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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