file_str_read (var handle,STRING* string)

file_str_readto(var handle, STRING* string, char *delimiter, var length)

Reads text from the file with the given handle into the given string, until a delimiter is reached. This way, comma separated strings from a database file can be read. The file must be open for reading.

Parameters:

handle - File handle.
string - string to receive the read content, A7.2 or NULL for just skipping content of the file.
delimiter - STRING* or char*, used as end mark for the text, or NULL for no end mark.
length - maximum number of characters to be read (1..4000).

Returns:

0..4000 - number of characters read (4000 max)
-1 - end of file reached

Remarks:

Example:

STRING* sTest = "     ";
...
fhandle = file_open_read("test.txt"); // test.txt contains "this,is,a,test"
file_str_read(fhandle,sTest); // sTest now contains "this"
file_close(fhandle);

See also:

file_open_read, file_close, file_var_read, file_str_write, file_chr_read, file_asc_write, file_asc_read, txt_load, delimit_str ► latest version online