gpt4 book ai didi

linux 打开返回 0

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:39:42 24 4
gpt4 key购买 nike

代码是这样的:

int fd = open(filename, O_RDONLY);

“最大打开文件数”为 1024。该进程可能会打开数百个文件。一开始,它运作良好。过了一会,open返回0,不知道为什么。帮助!!!提前致谢!

ps: 不是 int fd = open(filename, O_RDONLY) == -1;

最佳答案

open 返回 0 时,它告诉你如果你想使用你刚刚打开的文件,你应该使用 fd 0。

你是否关闭了 stdin?

关于linux 打开返回 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15858330/

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