【发布时间】:2015-02-01 07:55:52
【问题描述】:
文件“~/workspace/Test.txt”确实存在,但 fd 总是返回 -1。有人可以提示代码有什么问题吗?谢谢。
int fd = open("~/workspace/Test.txt", O_RDONLY);
cout << "fd is "<<fd<<endl;
if (fd < 0) {
cout << "did not find file"<<endl;
return false;
}
【问题讨论】:
标签: c++