gpt4 book ai didi

java - 输入输出 : Writing and reading to the same text file from a C++ program and from another Java program simultaneously?

转载 作者:行者123 更新时间:2023-11-28 08:01:11 26 4
gpt4 key购买 nike

是否可以同时使用 C++ 应用程序和 Java 应用程序读取和写入同一个文本文件,而不会向其中写入冲突的行/字符?我现在已经用两个 java 应用程序进行了测试,似乎可以从一个进程写入文件,即使另一个进程打开了流,但没有关闭它。有什么方法可以锁定文件以便其他进程需要等待吗?

最佳答案

关于java - 输入输出 : Writing and reading to the same text file from a C++ program and from another Java program simultaneously?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11434744/

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