If the file fileName exists, it is sourced (must be a script). Otherwise if the library fileName+"shared lib extension" exists, it is loaded (must be a shared library). Returns 0 on success, 1 otherwise. If an error occurs, an error message is written to msg.
Reads file and writes it to varName. Returns 0 on success, 1 otherwise. If an error occurs, an error message is written to the variable msg.
works best on local filesystems.
Please read the documentation of
lockf() on your
system to learn about the problems and limitations of file locking.
web::lockfile also performs a
resets the file cursor to the beginning of the file.
Note that the file needs to be open for
truncate(). Truncates a file based on
the file handle, while Tcl's file commands are based on file
names. This is used to truncate a file while holding the lock.
Example 14. web::lockfile
set fh [open [web::tempfile] w] web::lockfile $fh puts $fh foo web::unlockfile $fh close $fh