ReadFileString

Last Updated2008-12-05
Created At2007-12-16

Reads a UTF8 or ANSI string from a file.

native int ReadFileString(Handle hndl, char[] buffer, int max_size, int read_count = -1)

Parameters

Handle hndl
Handle to the file.
char[] buffer
Buffer to store the string.
int max_size
Maximum size of the string buffer.
int read_count
If -1, reads until a null terminator is encountered in the file. Otherwise, read_count bytes are read into the buffer provided. In this case the buffer is not explicitly null terminated, and the buffer will contain any null terminators read from the file.

Return Value

int Number of characters written to the buffer, or -1 if an error was encountered.

Error

Invalid Handle, or read_count > max_size.