From: dblack@... Date: 2002-09-10T00:55:46+09:00 Subject: Re: Reading in Hex numbers. Hi -- On Mon, 9 Sep 2002, Khurram wrote: > Hi all, > > I want to read in a file that has hex numbers, which are stored with > the "0x" hex prefix (i.e. 0x12345678). Is there a built in function > that will do the conversion, similiar to "to_i", for hex numbers? > > Also... is there something also for binary? Octal? For hex and octal you could use scanf (http://www.rubyhacker.com/code/scanf), though the more general solution of Integer might be better if you're also doing binary. (Hmmm... binary in scanf... hmmm...) David -- David Alan Black | Register for RubyConf 2002! home: dblack@candle.superlink.net | November 1-3 work: blackdav@shu.edu | Seattle, WA, USA Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com