Discussion Locked

Opening files in hex using Microsoft Vis

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How can I open a file for reading in hex format in C/C++?

The file contains a sequence of hex numbers that I need for calculations, so I should be able to read and use that data. Can anybody help me please?

6 replies

by pvp

You're always reading files as a byte-stream anyway.

Use fread(), where you have to specify the number of bytes to read.

How you interpret the bytes is up to you.

by lastorck

I think you can use %x or %ux spec. in fscanf() or "hex" manipulator for fistream. If you read text file with hex values represented as strings in it of course.
Regards

This discussion is closed to new replies.