Click or drag to resize

FReadText3 Function

Read characters from a file into a buffer variable that is passed by reference.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION FReadText3(
	ptrHandle AS IntPtr,
	pData AS IntPtr,
	dwBytes AS DWORD
) AS DWORD
View Source

Parameters

ptrHandle
Type: IntPtr
The handle of the file to read from.
pData
Type: IntPtr
A block of memory to store the data read from the specified file. The length of this variable must be greater than or equal to the number of bytes in the next parameter.
dwBytes
Type: UInt32
The number of bytes to read into the buffer.

Return Value

Type: UInt32
The number of bytes successfully read.  A return value less than <dwBytes> or 0 indicates end-of-file or some other read error.  FError() can be used to determine the specific error.
Remarks
FReadText() is the same as FRead() except that an OEM to ANSI conversion is made if SetAnsi() is FALSE.
Remarks
Tip Tip
This function is included for compatibility. We do not recomment using static memory for file i/o operations. We recommend that you use the function overload that takes a byte array parameter in stead.
Examples
This example uses FRead() after successfully opening a file to read 128 bytes into a buffer area:
X#
DEFINE F_BLOCK := 128
...
cBuffer := Space(F_BLOCK)
ptrHandle := FOpen("temp.txt")
IF FError() != 0
        ? DOSErrString(FError())
ELSE
        IF FReadText(ptrHandle, @cBuffer, F_BLOCK) <> F_BLOCK
                ? DOSErrString(FError())
        ENDIF
        FClose(ptrHandle)
ENDIF
See Also