gpt4 book ai didi

c - 如何在 C 编程中锁定文件并避免在写入时读取文件

转载 作者:行者123 更新时间:2023-11-30 20:07:33 25 4
gpt4 key购买 nike

我想在写入时锁定文件,任何人都不能读取它。如何做到这一点?...请提供示例代码。

最佳答案

你用fopen吗?然后

fopen

x -Open the file exclusively (like the O_EXCL flag of open(2)). If the file already exists, fopen() fails, and sets errno to EEXIST. This flag is ignored for fdopen().

关于c - 如何在 C 编程中锁定文件并避免在写入时读取文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11824183/

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