FileToString -- read whole file into a string (V5.0)
s$, len = FileToString(file$[, t])
This command is a convenience function which simply reads the specified file into memory and returns it as a string. The second return value contains the file length in bytes. Note that since Hollywood strings can also contain binary data, you can also use this function to read non-text files into strings.

Starting with Hollywood 10.0, FileToString() accepts an optional table argument that allows you to pass additional arguments to the function. The following tags are currently supported by the optional table argument:

This tag allows you to specify one or more file adapters that should be asked if they want to open the specified file. If you use this tag, you must set it to a string containing the name(s) of one or more adapter(s). Defaults to the adapter set using SetDefaultAdapter(). See Loaders and adapters for details. (V10.0)

This tag can be used to specify additional data that should be passed to file adapters. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

file to read into string
optional: table containing additional options (see above) (V10.0)
contents of the specified file as a string
length of the file in bytes

Show TOC