我遇到了此execve
命令的问题。我可以用它在我的程序中运行大多数其他命令,但是如果我尝试像man ls
或其他东西那样得到此错误。execve error当调用execve(man,args,env)
man: can't execute pager: No such file or directory
man: command exited with status 255: LESS=-ix8RmPm Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=ls(1) pager -s
这里是我怎样,我称之为:
execve(cmdPath, args, env);
其中cmdPath
是路径(在这种情况下/usr/bin/man
) args
是char*
其中args[0] = man
,args[1] = ls
env
是我env*[]
从传递主要。
任何帮助将不胜感激。我在这里死去。
可以运行'男人ls'正确地从您用来启动程序相同的壳呢? – us2012 2013-02-10 05:23:52
耶只好。 – 2013-02-10 05:24:53
你可以用'args [0] = ls' – Ganesh 2013-02-10 05:46:18