How do i read a 64-bit unsigned integer from a file? I’ve got it stored as actual binary data, not a string representation.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How is it encoded? Binary numbers usually differ in endianness. If you want to assume it’s the same as the current host’s endianness, you can use
freaddirectly. Otherwise, you’ll need to byte-swap it after reading.For bonus points, assuming you have control over how it’s serialized, you could indicate the endianness with some flag or byte order mark.