txt_for_dir(
TEXT*,STRING* name)
Reads all file names that match the given string into
separate
strings
of
a
text
object. This instruction can be used to scan a folder.
Parameters:
name |
File names (C-style with wildcards) to be matched. |
TEXT* |
Pointer to the TEXT object to be filled |
Returns:
Number of strings filled.
Speed:
Slow
Remarks:
- '*' and '?' wildcards and subfolders can be used. "*.*" matches
all files, "texts\\*.txt" matches
all files with txt extension in the texts subfolder.
Do not use absolute path addresses as they probably won't work on the end user's
systems.
- Only non-empty files will be found. The RESOURCE and PATH statements
will not be used for searching the files.
- Found files can be opened with file_open_read or file_open_write.
Example (lite-C):
TEXT* tDir = { strings = 30; flags = SHOW; } // empty text with 30 strings
function main()
{
txt_for_dir(tDir,"*.*"); // fill text with 30 file names from the current folder
}
See also:
txt_load,
txt_addstring
► latest
version online