Click or drag to resize

FGetS2 Function

X#
Read a line from an open file, specifying two strongly typed arguments.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION FGetS2(
	ptrHandle AS IntPtr,
	dwMax AS DWORD
) AS STRING
Request Example View Source

Parameters

ptrHandle
Type: IntPtr
The handle of the file to read from.
dwMax
Type: DWord
The maximum number of characters to read per line. FGets2() will read until a hard carriage return (Chr(13)) is reached, end-of-file is encountered, or dwMax characters are read.
The default value for dwMax is 256.

Return Value

Type: String
The line read. When the end-of-file is reached, FGets2() returns a NULL_STRING and FError() is set to 257.
Remarks
This function is the same as FReadLine2(). Both functions are assumed to handle raw binary data and are not dependent upon the status of SetAnsi(). FReadText() and FRead4(), on the other hand, are dependent upon SetAnsi().
Examples
This example uses FGets2() to read an entire file with a maximum of 80 characters per line:
X#
1ptrHandle := FOpen2("docs.txt", FO_READ)
2IF ptrHandle != F_ERROR
3    DO WHILE !FEOF(ptrHandle)
4        ? FGets2(ptrHandle, 80)
5    ENDDO
6ENDIF
7FClose(ptrHandle)
See Also