2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > c语言调用exe并传递参数 如何使用execlp将命令行参数传递给C程序

c语言调用exe并传递参数 如何使用execlp将命令行参数传递给C程序

时间:2021-09-02 09:04:16

相关推荐

c语言调用exe并传递参数 如何使用execlp将命令行参数传递给C程序

This page包括大量的使用示例....

编辑:从链接 从链路的代码段添加的代码片段上方

static void show_info_page(const char *git_cmd)

{

const char *page = cmd_to_page(git_cmd);

setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);

execlp("info", "info", "gitman", page, (char *)NULL);

die(_("no info viewer handled the request"));

}

编辑:execlp的补充说明(3)来回MTHE手册页 FreeBSD的手册页说明)execlp的使用(如下

int

execlp(const char *file, const char *arg, ... /*, (char *)0 */);

The initial argument for these functions is the pathname of a file which

is to be executed.

The const char *arg and subsequent ellipses in the execl(), execlp(), and

execle() functions can be thought of as arg0, arg1, ..., argn. Together

they describe a list of one or more pointers to null-terminated strings

that represent the argument list available to the executed program. The

first argument, by convention, should point to the file name associated

with the file being executed. The list of arguments must be terminated

by a NULL pointer.

The functions execlp(), execvp(), and execvP() will duplicate the actions

of the shell in searching for an executable file if the specified file

name does not contain a slash ``/'' character. For execlp() and

execvp(), search path is the path specified in the environment by

``PATH'' variable. If this variable is not specified, the default path

is set according to the _PATH_DEFPATH definition in , which is

set to ``/usr/bin:/bin''

PS:一些信息,如默认的搜索路径,垫变化根据您的系统

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。