Reading bytes and converting to int

joao joao.rab at hotmail.com
Sat Aug 25 08:23:43 PDT 2012


Hello everyone, I recently discovered the D language.
So, I want to open a file a read 4 bytes and get the int value.

string bytes = f.read(4)

I tried to cast but give me message it was deprecated.

uint value = cast (uint) bytes

If bytes was for example, "\x24\x00\x00\x00" I would like to 
value to be 0x24.
I know how to do this in Python, it is done with struct.unpack.
Thanks.


More information about the Digitalmars-d-learn mailing list