1
记事本能击败所有人吗?
在Windows Server 2012 R2系统上,Kotlin程序用于FileChannel.tryLock()在文件上持有排他锁,如下所示: val fileRw = RandomAccessFile(file, "rw") fileRw.channel.tryLock() 锁定后,我无法使用以下方式打开文件: 写字板 记事本++ 使用C#以编程方式获取以下任何值FileShare: using (var fileStream = new FileStream(processIdPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var textReader = new StreamReader(fileStream)) { textReader.ReadToEnd(); } 在命令行中,type命令: C:\some-directory>type file.txt The process cannot access the file because another process has locked a portion of the …