NAME
File2List — Read file line-by-line into a list.
SYNOPSIS
File2List InFilePath ?ListVarName?
DESCRIPTION
Return Value
A list where each element was a line in the file.
Arguments
InFilePathWhere to find the file.
ListVarNameName of the list variable to populate. Optional. If variable does not already exist then one will be created.
More Info
Each line in the file will be an element in the list (see example).

The lines in the list will not have newlines at the end.

Passing a list variable name is optional. Either way, the command will return a list value.

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


For information regarding exceptions / errors, see here.
EXAMPLES
% set MyList {{Element 1} {Element 2} {Element 3}}
{Element 1} {Element 2} {Element 3}
% List2File $MyList test.txt
% File2List test.txt MyList2
{Element 1} {Element 2} {Element 3}
% puts $MyList2
{Element 1} {Element 2} {Element 3}
SEE ALSO
File2String, List2File, String2File
KEYWORDS
conversion, file, list