"Richard Heathfield" <in*****@invalid.invalidwrote in message
news:d9********************@bt.com...
me*********@yahoo.com said:
>hi
i hv stored 32 HEX numbers in a file and i want to load it into int
arr[32].
There is no such thing as a hex number.
But there are numbers with hexes on them. Like these.
>
Presumably you mean you've stored
the hexadecimal representations of 32 numbers. And now you want to convert
them back into numbers. That's easy enough. Just open the file, read in
each representation in turn, and pass it to strtoul, specifying 16 as the
third argument (the base specifier). Store the result in arr[i].
I suspect that the numbers have been stored in binary format. They could be
16 or 32 bit, little or big endian. So it is bit of a messy job to load them
portably, but it can be done.
To the OP, give us a hex (not hexed) dump of the file, with a list of the
values the numbers should take if you have them, an idea of the range if you
don;t have the numbers.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.