Open |
![]() |
|
long Open( LPSTR FileName, // file name BOOL Create = FALSE, // creation flag BOOL Truncate = FALSE, // truncation flag long Timeout = 5 // timeout );
long Open( LPWSTR FileName, // file name BOOL Create = FALSE, // creation flag BOOL Truncate = FALSE, // truncation flag long Timeout = 5 // timeout );
Open( FileName As Variant, // file name Create As Boolean = False, // creation flag Truncate As Boolean = False, // truncation flag Timeout As Long = 5 // timeout ) As Long
File access mode is determined by mode of operation of the object as shown below:
OBJECT | FILE | |
|
||
IXF_MODE_READ | IXF_FILE_READ | |
IXF_MODE_WRITE | IXF_FILE_WRITE | |
IXF_MODE_RDWR | IXF_FILE_RDWR |
File sharing mode is determined by mode of operation of the object as shown below:
OBJECT | FILE | |
|
||
IXF_MODE_READ | IXF_FILE_SHARE_READ | |
IXF_MODE_READ + IXF_MODE_READLOCK |
IXF_FILE_SHARE_RDWR | |
IXF_MODE_WRITE | 0 (not shared) | |
IXF_MODE_WRITE + IXF_MODE_WRITELOCK |
IXF_FILE_SHARE_RDWR | |
IXF_MODE_RDWR + IXF_MODE_WRITELOCK |
IXF_FILE_SHARE_READ | |
IXF_MODE_RDWR + IXF_MODE_RDWRLOCK |
IXF_FILE_SHARE_RDWR | |
Method can be used whenever file access and share mode can be solely determined by mode of operation of the object. Developer does not have to specify access mode and other file related parameters because these parameters result from mode of operation of the object specified during initialization. This means that you do not have direct control over file access mode; if file must be opened in specific access or share mode that cannot be achieved with Open method, OpenAdvanced should be used instead. For example, if file must be opened for shared access with manual locking only, Open method cannot be used because it opens file for exclusive access.
On completion internal object settings are set to default values. Active buffer is set to its maximum size, read and write counters are reset to zero, data buffers are cleared. File position is set at the beginning of the file (0).
Unicode version of the method should not be confused with Unicode system calls or Unicode text data. All versions of the method can be used on Unicode and non-Unicode systems depending on your needs. On Unicode systems, however, file is opened by Unicode version of system function (unless Unicode is disabled with EnableUnicode method). Conversion between ANSI and Unicode is performed internally according to current codepage which can be changed with SetCodePage method. See Unicode Support for more information on Unicode system calls, Unicode methods and Unicode text data.