小编the*_*gin的帖子

在c ++中检查文件是否只读

我想在Windows系统的c ++中检查.ini文件是否只读

例如:

if(file == readonly){
  //Do this
}
Run Code Online (Sandbox Code Playgroud)

到目前为止,我已尝试过这个并且它有效:

ofstream ofs(filename); //test to see if the file successfully opened for writing or not
Run Code Online (Sandbox Code Playgroud)

但结果它将删除.ini文件并将文件留空

PS:1.它不是重复的2.我在互联网上搜索过,我发现了一些可能有用的例子,但结果却没有按照他们的意愿进行编译.

c++ windows winapi readonly

1
推荐指数
1
解决办法
1007
查看次数

标签 统计

c++ ×1

readonly ×1

winapi ×1

windows ×1