The jfileio.tcl library is distributed as part of the jstools package. It consists of two procedures that slightly simplify file access.
This document describes jfileio.tcl version 4.0/4.0.
In order to use the jfileio.tcl library, it must be in your Tcl auto_path, described in tclvars(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.
Jay Sekora
js@calumet.org
http://shore.net/~js/
The library is copyright © 1992-1995 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.
j:fileio:write - write given text to a file
j:fileio:read - return contents of file
j:fileio:write filename text
filename is the name of the file to open for writing
text is the string to store in filename
This procedure writes the string text to the file named file. If the file can not be opened for writing, an error will occur (invoking the Tk procedure tkerror(n)) The previous contents of file, if any, will be overwritten. No additional newline is appended to text.
j:fileio:read file
file is the name of the file to open for reading
This procedure returns the contents of the file named file. If the file can not be opened for reading, an error will occur (invoking the Tk procedure tkerror(n))
* A procedure to append text to a file might be useful.
* It might be nice to catch errors, figure out what caused them, and display more informative error messages, or even give the user the opportunity to create missing directories or change permissions on files sie owns.