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 3.6/3.0.
Usage
Accessing the Library
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.
Credits and Copyright
Author
Jay Sekora
js@bu.edu
http://shore.net/~js/
Copyright
The library is copyright ⌐ 1992-1994 by Jay Sekora, but may be freely copied and modified for non¡commercial purposes. (Please contact me if you want to use it for a commercial purpose, this may be OK under some circumstances.)
Overview
Procedures
j:fileio:write - write given text to a file
j:fileio:read - return contents of file
j:fileio:write
Usage
j:fileio:write filename text
Arguments
filename is the name of the file to open for writing
text is the string to store in filename
Description
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
Usage
j:fileio:read file
Arguments
file is the name of the file to open for reading
Description
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))
Evolution
Feel free to report bugs (and feature requests) to me, <js@bu.edu>, and I will try to deal with them. Also, feel free to fix bugs or add features on your own and let me know how you did it.
Changes
The procedures in jfileio.tcl are new with version 3.6/3.0.
Future Directions
* 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.