FOpen2 Function | |
Open a file, specifying two strongly-typed arguments.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION FOpen2(
cFileName AS STRING,
kMode AS DWORD
) AS IntPtr
public static IntPtr FOpen2(
string cFileName,
uint kMode
)
Request Example
View SourceParameters
- cFileName
- Type: String
The file name, including an optional drive, directory, and extension. SetDefault() and SetPath() settings are ignored; the Windows default is used unless you specify a drive and directory as part of the file name. No extension is assumed.
This function sets NetErr() in case of a concurrency control conflict.
- kMode
- Type: DWord
This argument is the same as kMode used with FOpen(). See FOpen() for details.
Return Value
Type:
IntPtr
The file handle of the opened file in the range of 0 to 32,767.
If an error occurs, FOpen2() returns F_ERROR. FError() can be used to determine the specific error.
Remarks
Note that in order for two processes to use the same file simultaneously, both files should be opened in FO_SHARED sharing mode.
Examples
This example uses FOpen2() to open a file with sharable read/write status and displays an error message if the open fails:
1ptrHandle := FOpen2("temp.txt",;
2 FO_READWRITE + FO_SHARED)
3IF ptrHandle = F_ERROR
4 ? DOSErrString(FError())
5ENDIF
See Also