You can place the following lines of code into $HCIROOT/tcl/lib/localInit.tcl
***********************************
rename open fileOpen
proc open { fileName { access “r” } { permissions “0666” } } {
set fileHandle [ fileOpen $fileName $access $permissions ]
fconfigure $fileHandle -encoding binary -translation binary -eofchar {}
return $fileHandle
}
***********************************
In effect, this rewrites the open command and allows you to configure the channel to keep the EOL characters intact. This is a global change. Which is exactly what I needed. Going through our entire system and adding an fconfigure to every open was not an option.
One other thing, if you use the read_file command, you’ll need the following code added right below the code above:
************************************
rename read_file {}
proc read_file { args } {
if {[string equal [lindex $args 0] -nonewline]} {
lvarpop args
set nonewline 1
} else {
set nonewline 0
}
set fileName [ lvarpop args ]
set numBytes [ lvarpop args ]
set fd [ open $fileName r ]
fconfigure $fd -translation binary
if {$nonewline} {
set str [read -nonewline $fd]
} else {
if { $numBytes != “” } {
set str [read $fd $numBytes]
} else {
set str [read $fd]
}
}
close $fd
return $str
}
I ran into the same problem. I’m sure Charlie will let you know if I’ve missed something here.
Steve