gpt4 book ai didi

c - mkfifo() 错误 ---> "Error creating the named pipe.: File exists"

转载 作者:太空狗 更新时间:2023-10-29 17:10:07 34 4
gpt4 key购买 nike

mkfifo 函数有两个参数,路径和模式。但我不知道它使用的路径格式是什么。我正在编写一个小程序来创建命名管道并作为 mkfifo 中的路径。例如,使用 /home/username/Documents,但它始终返回 -1 并显示消息 Error creating the named pipe.: File exists

这个目录我检查了很多次,里面没有管道。所以我想知道问题是什么。我在 mkfifo 中使用的模式是 0666 或 0777。

最佳答案

你给了mkfifo() 现有 目录的名称,因此是错误。你必须给它一个不存在的文件的名称,例如

mkfifo("/home/username/Documents/myfifo", 0600);

关于c - mkfifo() 错误 ---> "Error creating the named pipe.: File exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13040021/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com