txt_load(TEXT*,STRING* filename)
txt_loadw(TEXT*,STRING* filename)
Opens an 8-bit ASCII (txt_load) or 16-bit Unicode (txt_loadw)
text file, reads its content into separate strings of a text
object, and closes the file. This instruction can be used to fill an
empty text object from a file.
Parameters:
filename |
Name of the text file to be read, STRING* or char*. |
TEXT* |
TEXT object to be filled. |
Returns:
Number of strings filled.
Remarks:
- This function uses file_str_readto to parse the file content into
separate strings. The text strings are created as variable length
strings. If the file contains more strings than the text, the rest
will be omitted.
- Aside from the division into separate strings, the file content
won't be modified, f.i. "\n" characters will not be converted to
line feeds.
- As with file_str_readto, the text file
must physically exist in the work folder.
Otherwise the path must be given with the file name.
- A7.84
txt_loadw can be used to load Unicode text from a file and display non-latin character sets, such as Greek, Arab, Hebrew, Cyrillic, or Chinese. For details see Unicode.
Speed:
Slow
Example:
TEXT* bigtext = { strings = 10000; flags = SHOW; } // empty text with a lot of strings
...
txt_load(bigtext,"bigfile.txt"); // fill the text, allocate strings
See also:
TEXT, file_str_readto, Unicode
► latest
version online