【发布时间】:2013-04-25 19:43:09
【问题描述】:
对于下面的 sn-p 代码,我得到一个错误:
Unable to open file: No such file or directory
redirect_ptr 是字符** 我试过打印redirect_ptr[0],它打印正确。知道问题可能出在哪里吗?
if ((in_fd = open(redirect_ptr[0], O_RDWR | O_CREAT)) == -1) {
perror("Unable to open file");
return -1;
}
【问题讨论】:
-
你真的有你想打开的文件吗?...
-
是的,无论如何都应该创建它
-
添加文件名的调试打印
标签: c file-io file-descriptor