Delpi FileStream Create Mode, FileOpen Access Mode
2013-04-30 08:36
387 查看
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. |
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. |
相关文章推荐
- Unable to open table file ..\data\model_ckpt: Unknown: NewRandomAccessFile failed to Create/Open:
- C++ file stream open mode vs C file stream open mode in Visual C++ 2013
- FileMode.Create and FileAccess.Write
- stream_context_create解决file_get_contents超时处理
- 在用VSS时遇到的一个问题:Access to file denied 或 Unable to open user login file
- Java基础---Java---IO流-----对象的序列化、管道流、RandomAccessFile、数据类型的流对象DataStream、ByteArrayStream
- How to create an OCM Response file to apply patch in silent mode - opatch silent (Doc ID 966023.1)
- file_get_contents: failed to open stream: No such file or directory
- Laravel访问出错错误信息:`Warning: require(/vendor/autoload.php): failed to open stream: No such file or dire
- file_get_contents failed to open stream: HTTP request failed(一个字符决定成败)
- Unable to open the physical file "d:\***.mdf". Operating system error 5: "5(Access is denied.)".
- 在把jQuery的ajax例子放在AppServ上运行时出错,failed to open stream: No such file or directory in Unknown on line 0
- 完美解决failed to open stream: HTTP request failed!(file_get_contents引起的)
- .net Create Excel 2007 file with open xml
- Oracle 在open一个插入的pdb时向本pdb的数据字典中插入datafile信息,而不是在create pluggable database时
- PHP解决[function.file-get-contents]: failed to open stream: HTTP request failed!
- failed to open stream: No such file or directory in includes/src/Varien_Autoload.php on l
- CreateTextFile&OpenTextFile
- OpenFile Operation not permitted on IsolatedStorageFileStream
- 打开外部文件的几种 语法, openFile <filename_string> [ mode:<mode_string> ]