Posted to tcl by schelte at Sat Aug 18 20:57:15 GMT 2012view raw

  1. proc main {} {
  2. for {set i 0} {$i < 256} {incr i} {
  3. lappend hex [format %02x\n $i]
  4. }
  5. set fp [open "testdata" rb]
  6. while {![eof $fp]} {
  7. set out ""
  8. binary scan [read $fp 30000] cu* bytes
  9. foreach n $bytes {
  10. append out [lindex $hex $n]
  11. }
  12. puts -nonewline $out
  13. }
  14. close $fp
  15. }
  16.  
  17. main