file_str_read (var handle,STRING* string)
Reads text from the file with the given handle into the given
string, until a delimiter is reached. The delimiter is either a '0' byte in
the file, or a line feed, or a comma (','). This way, comma separated strings
from a database file can be read. The file must be open for reading. The original
length of the string won't be overwritten.Parameters:
handle - File handle.
string - string to receive the file content.
Returns:
0..4000 - number of characters read (4000 max)
-1 - end of file reached
Remarks:
- The file must be open for reading.
- The delimiter is either a '0' byte in the file, or a line feed,
or a comma (','). The delimiter can be changed through the delimit_str variable.
- The original length of a fixed length string won't be changed.
The size of variable length
strings
will be automatically changed to the string read.
- The maximum string
size to be read is 4000 characters.
Example:
string test_str[8];
...
fhandle = file_open_read("test.txt"); // test.txt contains "this,is,a,test"
file_str_read(fhandle,test_str); // test_str 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