_access的C#/ .NET等效:非读取/写入非ReadOnly文件? [英] C#/.NET equivalent for _access: Is non ReadOnly files read/write?

查看:71
本文介绍了_access的C#/ .NET等效:非读取/写入非ReadOnly文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,我一直在尝试为C / C ++的io.access找到一个等效的方法或API(https://msdn.microsoft.com/en-us/library/1w06ktdy.aspx)

Good day, I have been trying to find an equivalent method or API for C/C++'s io.access (https://msdn.microsoft.com/en-us/library/1w06ktdy.aspx)

根据它的描述,我发现它与FileInfo.IsReadOnly类似(https://msdn.microsoft.com/en-us/library/system.componentmodel.readonlyattribute(v= vs.110).aspx)

based on it's description, I have found that it is similar with FileInfo.IsReadOnly (https://msdn.microsoft.com/en-us/library/system.componentmodel.readonlyattribute(v=vs.110).aspx)

C / C ++ io.access:" 如果文件是只读的,则确定
"

C#FileInfo.IsReadOnly: " 获取
或设置一个值,用于确定当前文件是否为只读。"

从描述中,我假设NOT readonly文件是读/写的,用于实现02的io.access模式:只写和06:读和写。

From the description, I assumed that NOT readonly files is read/write, and used this to implement io.access' mode for 02: write-only AND 06: read and write.

C / C ++ io.access:

C/C++ io.access:

模式值检查文件

00 - 仅存在

02 - 只写

04 - 只读

06 - 读写

FileInfo.IsReadOnly的实现:

Implementation for FileInfo.IsReadOnly:

FileInfo.IsReadOnly bool return

FileInfo.IsReadOnly bool return

false - 只写

false - Write-Only

true - 只读

true - Read-Only

false - 读写

false - Read-and-Write

*注意:File.Exists是针对模式0实现的:文件存在

*note: File.Exists is implemented for mode 0: File existence

我已经确认io.access和FileInfo.IsReadOnly的实现与ReadOnly文件和NOT ReadOnly文件的行为相同。

I have already confirmed that io.access and implementation of FileInfo.IsReadOnly behaves the same with ReadOnly files and NOT ReadOnly files.

我只需要查看是否有任何支持文件声明Non ReadOnly Files =读/写。

I just need to see if there are any supporting documents claiming that Non ReadOnly Files = Read/Write.

请帮助,谢谢!

推荐答案

_access / _waccess的Windows impl使用文件属性ReadOnly,因此检查4和6等同于检查ReadOnly属性。正如文档中所讨论的,Windows不会查看ACL,因此其他模式在Windows中并不是真正有用的
。 

The Windows impl of _access/_waccess uses the file attribute ReadOnly so checking for 4 and 6 are equivalent to checking for the ReadOnly attribute. As discussed in the documentation, Windows doesn't look at the ACLs so the other modes are not really useful in Windows. 

" 我只需要查看是否有任何支持文件声称非读取文件=读/写。"

这对我来说真的没有意义。 ReadOnly表示不读/写。所以不是ReadOnly将不是读/写,这是读/写。不确定为什么你需要文档来验证双重否定或澄清只有2个选项(在这个
特定情况下)是读和写。请注意,Not ReadOnly可能表示RW,但并不一定意味着创建和删除。那些不是由属性表示(或由_access函数处理)。

That doesn't really make sense to me. ReadOnly indicates Not Read/Write. So Not ReadOnly would be Not Not Read/Write which is Read/Write. Not really sure why you need documentation to validate a double negative or to clarify that the only 2 options (in this particular case) are Read and Write. Note that Not ReadOnly may indicate RW but it doesn't necessarily mean Create and Delete. Those aren't represented by attributes (or handled by the _access function).

< span style ="">


这篇关于_access的C#/ .NET等效:非读取/写入非ReadOnly文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆