我在使用此execve命令时遇到问题。我可以使用它在我的程序中很好地运行大多数其他命令,但是如果我尝试做类似的man ls事情或其他事情,我会收到此错误。
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*[]从 main 传递的。
任何帮助将非常感激。我要死在这里了。