- Publicity: Public Only All
utilities-procs.tcl
XOTcl - Utility procs for file I/O. Should not be necessary on the longer run.
- Location:
- packages/xotcl-core/tcl/utilities-procs.tcl
- Author:
- Gustaf Neumann
Procedures in this file
- xo::write_tmp_file (public)
Detailed information
xo::write_tmp_file (public)
xo::write_tmp_file varFilename content
Write binary content to a temporary file and set its path in the caller.
- Parameters:
- varFilename (required)
- Name of the caller variable to receive the path.
- content (required)
- Bytes to write.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Content File Source
::xo::library doc { XOTcl - Utility procs for file I/O. Should not be necessary on the longer run. @author Gustaf Neumann } namespace eval ::xo { proc read_file {fn} { set F [open $fn] ::fconfigure $F -translation binary ::set content [read $F] ::close $F return $content } proc write_file {fn content} { set F [::open $fn w] ::fconfigure $F -translation binary ::puts -nonewline $F $content ::close $F } ad_proc -public write_tmp_file {varFilename content} { Write binary content to a temporary file and set its path in the caller. @param varFilename Name of the caller variable to receive the path. @param content Bytes to write. } { upvar $varFilename tmpFileName set F [file tempfile tmpFileName] fconfigure $F -translation binary puts -nonewline $F $content close $F } } # # Local variables: # mode: tcl # tcl-indent-level: 2 # indent-tabs-mode: nil # End: