I have a text file with hexadecimal values, after I fscanf a value I need to know how I can convert it from hexadecimal string to an int. And then convert it back to hexadecimal string for a later print. Anyone knows an algorithm for this? thank you.
Share
You should use the
%xformat specifier instead of%sto read your values. This will read the data as hexadecimal integers.For example, if your file looks like this:
Then you can read those 3 values like this: