Home
DevCentral
Search
Configure Global Search
Log In
Transactions
P84
Change Details
Change Details
Old
New
Diff
set fd [open code.txt r] set code [gets $fd] close $fd proc bin2dec {bin} { if {$bin == 0} { return 0 } elseif {[string match -* $bin]} { set sign - set bin [string range $bin 1 end] } else { set sign {} } if {[string map [list 1 {} 0 {}] $bin] ne {}} { error "argument is not in base 2: $bin" } set r 0 foreach d [split $bin {}] { incr r $r incr r $d } return $sign$r } for {set i 0} {$i < 100} {incr i} { set start [expr $i * 8] puts -nonewline [format %c [bin2dec [string range $code $start [expr $start+7]]]] }
set fd [open code.txt r] set code [gets $fd] close $fd proc bin2dec {bin} { if {$bin == 0} { return 0 } elseif {[string match -* $bin]} { set sign - set bin [string range $bin 1 end] } else { set sign {} } if {[string map [list 1 {} 0 {}] $bin] ne {}} { error "argument is not in base 2: $bin" } set r 0 foreach d [split $bin {}] { incr r $r incr r $d } return $sign$r } for {set i 0} {$i < 100} {incr i} { set start [expr $i * 8] puts -nonewline [format %c [bin2dec [string range $code $start [expr $start+7]]]] }
Continue