conv

A small, but useful, tool for converting numbers to and from different formats (binary, hex, oct, dec, char). Written in C, so not really directly related to Tcl, but was told on IRC that it might be good to post here nonetheless. If I made the tool today I'd most definitely write it in Tcl. --setok

Get it from http://people.fishpool.fi/~setok/products/conv.tar.gz


Talk

RS Note however that expr and format in an interactive tclsh, or an interactive console in any Tk app, can do these tasks pedestrianly, which I often use, instead of bothering to search for (or write) a tool:

 % expr 0x4711 ;# hex to dec: just prefix 0x
 18193
 % expr 01234567 ;# octal to dec: just prefix a zero (while the feature is still there :)
 342391
 % format %o 0x4711 ;# any to oct/hex, use % format
 43421

Setok The biggest problem for me is that they can't handle binary numbers. The C code for the above is almost as simple as what you're doing. It's just handy to have as a binary in my path.