博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Delpi FileStream Create Mode, FileOpen Access Mode
阅读量:6161 次
发布时间:2019-06-21

本文共 2228 字,大约阅读时间需要 7 分钟。

fmOpenRead       = $0000;  fmOpenWrite      = $0001;  fmOpenReadWrite  = $0002;  fmExclusive      = $0004; // when used with FileCreate, atomically creates the file only if it doesn't exist, fails otherwise  fmShareCompat    = $0000 platform; // DOS compatibility mode is not portable  fmShareExclusive = $0010;  fmShareDenyWrite = $0020;  fmShareDenyRead  = $0030 platform; // write-only not supported on all platforms  fmShareDenyNone  = $0040;
constructor Create(const AFileName: string; Mode: Word); overload;

Call Create to instantiate a file stream for reading from or writing to the named file. Specify the name of the file and the way the file should be opened as parameters. 

function FileOpen(const FileName: string; Mode: LongWord): Integer;

Use FileOpen to open a file and obtain a file handle. The access mode value is constructed by or-ing one of the fmOpen constants with one of the fmShare constants defined in File open mode constants. If the return value is 0 or greater, the function was successful and the value is the file handle of the opened file. A return value of -1 indicates that an error occurred. 

 

The Mode parameter indicates how the file is to be opened. The Mode parameter consists of an open mode and (possibly) a share mode or'ed together. The open mode must be one of the following values:

Value 
Meaning 
fmCreate  
Create a file with the given name. If a file with the given name exists, open the file in write mode.  
fmOpenRead  
Open the file for reading only.  
fmOpenWrite  
Open the file for writing only. Writing to the file completely replaces the current contents.  
fmOpenReadWrite  
Open the file to modify the current contents rather than replace them.  

The share mode must be one of the following values:

Value 
Meaning 
fmShareCompat  
Sharing is compatible with the way FCBs are opened.  
fmShareExclusive  
Other applications can not open the file for any reason.  
fmShareDenyWrite  
Other applications can open the file for reading but not for writing.  
fmShareDenyRead  
Other applications can open the file for writing but not for reading.  
fmShareDenyNone  
No attempt is made to prevent other applications from reading from or writing to the file.  

If the file can not be opened, Create raises an exception. 

 

转载地址:http://izafa.baihongyu.com/

你可能感兴趣的文章
MoSQL
查看>>
Hibernate多对一外键单向关联(Annotation配置)
查看>>
《CLR via C#》读书笔记 之 方法
查看>>
设计模式:组合模式(Composite Pattern)
查看>>
ContentValues 和HashTable区别
查看>>
LogicalDOC 6.6.2 发布,文档管理系统
查看>>
给PowerShell脚本传递参数
查看>>
实战2——Hadoop的日志分析
查看>>
利用FIFO进行文件拷贝一例
查看>>
Ecshop安装过程中的的问题:cls_image::gd_version()和不支持JPEG
查看>>
resmgr:cpu quantum等待事件
查看>>
一个屌丝程序猿的人生(六十六)
查看>>
Java 编码 UTF-8
查看>>
SpringMVC实战(注解)
查看>>
关于静态属性和静态函数
查看>>
进程的基本属性:进程ID、父进程ID、进程组ID、会话和控制终端
查看>>
spring+jotm+ibatis+mysql实现JTA分布式事务
查看>>
MyBatis启动:MapperStatement创建
查看>>
调查问卷相关
查看>>
eclipse启动无响应,老是加载不了revert resources,或停留在Loading workbench状态
查看>>