I've got a textfile containing about 30 thousand 256-digit numbers in hex. I need to read them in and work on them one by one. Reading them is fine using
Read["hello.txt",Expression]
Then I would like to turn each number into a fixed-length binary number, using something like
IntegerDigits[16^^p, 2, 27]
The problem is, this doesn't work. The argument of ^^ seems to need to be an actual number in hex, e.g. 16^A12B3, rather than a variable.
Given that essentially ^^ is a two-argument function, is there a way to express it as such in Mathematica?
I'm even having trouble getting the input to be accepted as a number at all . Replacing "Expression" (or "String") with "Number" or "Integer" doesn't work.
Will be grateful for any help with this.
Thanks!
Michael
var = "f8";
int=ToExpression["16^^" <> var]
IntegerDigits[int, 2, 27]
David Bailey
http://www.dbaileyconsultancy.co.uk