FReadLine2 Function | |
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 FReadLine2(
ptrHandle AS IntPtr,
dwMax AS DWORD
) AS STRING
public static string FReadLine2(
IntPtr ptrHandle,
uint dwMax
)
Request Example
View SourceParameters
- ptrHandle
- Type: IntPtr
The handle of the file to read from. - dwMax
- Type: DWord
The maximum number of characters to read per line. FReadLine2() 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 while attempting to read, FReadLine2() returns a NULL_STRING and FError() is set to 257.
Remarks
This function is the same as FGets2(). 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 FReadLine2() to read an entire file with a maximum of 80 characters per line:
1hF := FOpen2("docs.txt", FO_READ)
2IF hF != F_ERROR
3 DO WHILE !FEOF(hF)
4 ? FReadLine2(hF, 80)
5 ENDDO
6ENDIF
7FClose(hF)
See Also