From e532eb0caf43a7e9e3a624adfd857b733a55eeb5 Mon Sep 17 00:00:00 2001 From: cas Date: Tue, 19 Jun 2001 17:56:24 +0000 Subject: [PATCH] No comments --- src/WOKTclLib/wutils.tcl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/WOKTclLib/wutils.tcl b/src/WOKTclLib/wutils.tcl index 7f57178..fbae5ab 100755 --- a/src/WOKTclLib/wutils.tcl +++ b/src/WOKTclLib/wutils.tcl @@ -143,6 +143,30 @@ proc wokUtils:FILES:ValidName { name } { return [expr ([regexp {^-.*} $name]) ? 0 : 1] } # +# Read a file in a string as is. +# +proc wokUtils:FILES:FileToString { fin } { + if { [catch { set in [ open $fin r ] } errin] == 0 } { + set strin [read $in [file size $fin]] + close $in + return $strin + } else { + return {} + } +} +# +# Write a string in a file +# +proc wokUtils:FILES:StringToFile { str path } { + if { [catch { set out [ open $path w ] } errout] == 0 } { + puts -nonewline $out $str + close $out + return 1 + } else { + return {} + } +} +# # Read file pointed to by path # 1. sort = 1 tri # 2. trim = 1 plusieurs blancs => 1 seul blanc -- 2.39.5