Click or drag to resize

FOpen2 Function

Open a file, specifying two strongly-typed arguments.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION FOpen2(
	cFileName AS STRING,
	kMode AS DWORD
) AS IntPtr
View Source

Parameters

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: UInt32
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:
X#
ptrHandle := FOpen2("temp.txt",;
        FO_READWRITE + FO_SHARED)
IF ptrHandle = F_ERROR
        ? DOSErrString(FError())
ENDIF
See Also