Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
open() 的返回值为 -1,在尝试使用 perror() 查找错误时,输出为“文件存在”。
如何找到错误或文件未打开的原因。
好像
EEXIST 路径名已经存在并且使用了 O_CREAT 和 O_EXCL。
您可能会给出带有引号的宏,如下所述:
fd = 打开(文件名,“O_RDONLY”);
它应该fd = open(filename,O_RDONLY);没有引号。
fd = open(filename,O_RDONLY);