execl() 返回“无法打开或解析参数”错误
execl() returns `cannot open or parse argument` error
我有这段代码来运行一个使用 execl() 的程序,我收到这个错误:
Cannot open or parse ' arg 3'.
而且,当我删除参数 3 时,我收到参数 2 的相同错误,知道吗?
我正在调试,显然第一次是_pid大于 0,为什么可能?
int down[2], up[2];
pipe(down); // creates pipe - [0] is for reading, [1] for writing
pipe(up);
pid_t _pid = fork();
if (_pid < 0)
exit(1);
if (_pid == 0)
{
close(down[1]);
close(up[0]);
dup2(down[0], 0);
dup2(up[1], 1);
execl(cmd_line, cmd_line, "arg 1", "arg 2", "arg 3", NULL);
_exit(1);
}
// the rest of this fn is executed by the parent only
close(down[0]);
close(up[1]);
_down = down[1];
_up = up[0];
_reader_thd = new Thread(reader_wrapper, this);
听起来更像是你正在执行的任何内容都无法打开或解析你的参数。
相关文章:
- C++声明模板参数阴影模板参数错误
- 为什么 CRTP 模板C++给出无效参数错误?
- (C/C++)fscanf_s从txt文件以字符形式读取数组时缺少整数参数错误
- 参数错误可能与类型不匹配有关?
- printf 和 strftime 的参数错误无效
- 如何修复"ctypes"。参数错误:参数 2:<键入"异常.类型错误">:RaspberryPi 中的错误类型"错误
- 如何修复"没有重载函数需要 2 个参数"错误C++
- 术语不计算为函数采用 1 个参数错误?
- 从带有 getline() 的文件读入一行上有多个信息得到无效参数错误
- 为什么我不能像使用 std::string::size_type 那样使用 QList::size_type?(模板参数错误)
- cudaFreeHost() 无效参数错误
- 精神语法不会编译:函数模板参数错误?
- C 功能具有参考参数错误的迭代器错误.寻求解释
- 使用getDefaultCommConfig使用无效的参数错误
- C++ 可变参数模板和模板模板参数:错误:模板参数列表中参数 1 处的类型/值不匹配
- 使用SWIG生成的Python库时,向量分配器参数错误
- 错误C2664:无法转换参数错误
- C 作为参数错误的功能
- 命令行参数错误
- 增强Python参数错误