D Programming: How would I read a 64-bit integer from a file?

Hex looks like this: <"0000000000005205" →. I want it to return 0x5205 instead of reading it as 383368918279913472. How do I do this?

+4
source share
2 answers

It looks like a big-endian. Use bigEndianToNative from std.bitmanip.

+9
source

See: http://dlang.org/phobos/std_conv.html#parse

 auto myInt = parse!ulong(textFromFile, 16); 
+2
source

Source: https://habr.com/ru/post/1388738/


All Articles