我正在打开要创建的视频的文件,并使用C ++中的fopen打开文件并将其写入磁盘,我可以将其写入磁盘。但是,当我尝试在编写文件时读取它时,它会抛出错误,表明我没有在关闭文件或停止程序后立即读取文件的权限,因此可以突然读取它。 >
[没有像我使程序崩溃那样完成写操作的问题,仍然可以读取它。另外,VLC的日志告诉我这是一个权限问题。
任何想法如何更改该权限?
响应William询问代码片段,或者打开是否在文件存在之前发生:
Thanks William, here's what I've got. I waited a few minutes and could see the file with windows explorer by that point and waited until after I'd flushed and data was there, couldn't open with VLC or Notepad++ or Notepad or Windows Media Player
Notepad says cannot access because it is being used by another process, others too.
Here is the VLC log while it tries to open this:
http://snippi.com/s/g4cbu23
Here is where I create the file with fopen:
http://snippi.com/s/cyajw4h
At the very end is where I write to the file using fwrite and flush:
http://snippi.com/s/oz27m0g
我正在打开要创建的视频的文件,并使用C ++中的fopen打开文件并将其写入磁盘,我可以将其写入磁盘。但是,当我尝试在编写本书时阅读它时,它会抛出错误,指出它不是...
如果要共享文件,则需要将_fsopen
与_fsopen
一起使用。