It sounds like you're getting a hexadecimal string, and need to store the numeric value in a variable. Then, at some point in the future, you need to convert back from the variable to a string.
You don't have to worry about the internal representation used by basic numeric types (int, long, float). While the computer will natively store the value in binary, programming languages are designed so that this fact is (somewhat) hidden from you, so you don't have to worry about it.
Now that we've let the language abstract away the internal storage as "a number" all we need is a way to read and to write that number. All languages have functions that will let you read/write data in different formats, and you can always roll your own (though that's not recommended unless you're just learning) so I'm using C.
C offers scanf() and printf() - there's other functions that will do the job, too, but these are a decent example of stuff you can use. These functions are very similar, so it's easy to write some code:
#include <errno.h>
#define FORMAT "%X"
// Converts string input into n integer
//
// args
// str the string to convert
// x pointer to location for return value
//
// returns
// 0 on success
// nonzero on failure
int get_num_from_hex_string(char* str, int* x)
{
if( str == 0 ) return EINVAL;
// we assume MAX_LEN is defined, somewhere...
if( strlen(str) > MAX_LEN ) return EINVAL;
int result = scanf(FORMAT, x);
// there's prolly a better error, but good enough for now
if( result != 1 ) return EIO;
return 0;
}
// Converts an integer into a hex string
//
// args
// x - the integer to convert
// str - the pre-allocated output buffer
// len - amount of space left in str. Must be
// at least 12 bytes.
//
// returns
// 0 on success
// nonzero on failure
int get_hex_string(int x, char*str, int len)
{
if( str == 0 ) return EINVAL;
if( len < 12 ) return EINVAL;
sprintf(str, FORMAT, x);
}