a few meg is not big ! You should do this with a script language, e.g. in python
out = open("outfile", "w")
try:
for line in open(myfile, "r"):
out.write(int(line, 16))
finally:
out.close()
Assuming it is one hex/line. Even if your hex are not consistent, and you need a regex to parse them, it will almost certainly take less than a few seconds on a decent computer. I would not bother with C unless you file is several GB :)
Now, if you need to do this in C, writing the integers is very easy once you have parsed them. What's your problem exactly ? To write to a file ? Or you do have the hex numbers as strings in a file ? In that later case, you could use fscanf with the x format. Or str* functions, as suggested by Jared.