文件打开时出错:文件存在
open() 的返回值为 -1,尝试使用 perror() 查找错误时,输出为“文件存在”。
如何查找错误或文件无法打开的原因。
The return value of an open() was -1 and on trying to find the error using perror() the output was "File exists".
How do I find the error or the reason for the file not opening.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来像
Looks like
您可能会给宏加上引号,如下所述:
它应该是
fd = open(filename,O_RDONLY);
不带引号。You probably would have given the macro with the quotes as described below:
It should be
fd = open(filename,O_RDONLY);
without quotes.