Numeric access to char[]

nobody nobody at
Mon Aug 21 15:54:02 PDT 2006

Peter Thomassen wrote:
> Hi,
> how is it possible to work on the numeric value of a char[]? I'm interested
> in bit shifting and arithmetic operations on the numeric value.
> Thanks!
> Peter

I am pretty sure you can just treat a char as a ubyte. The char type is 8 bits 
and unsigned. However if it makes it easier for you then you might try this:

   int main(char[][] args)
     ubyte[] num1 = cast(ubyte) args[0];

More information about the Digitalmars-d-learn mailing list