NAME
File2String — Read file into a string and return it.
SYNOPSIS
File2String InFilePath ?StringVarName?
DESCRIPTION
Return Value
A string with the contents of the file.
Arguments
InFilePathWhere to find the file.
StringVarNameName of the string variable to populate. Optional. If variable does not already exist then one will be created.
More Info
Note that there already exists the command ::fileutil::cat, which is practically the same in functionality, but has a different arguments. We missed this when putting together Gen, and thanks to those who pointed it out. You may well prefer to use this command.

Note this assumes UTF-8 encoding. Support for flags should come in a future release.

Note also that this returns the contents of the file, so the second argument is optional.


For information regarding exceptions / errors, see here.
EXAMPLES
% set MyString 1-2-3
1-2-3
% String2File $MyString temp.txt
% File2String temp.txt
1-2-3
SEE ALSO
File2List, List2File, String2File
KEYWORDS
conversion, file, string