Q:

Convert a series of typedefs to a char array

Thanks in advance for the help.
trying to use a fairly large C/Cpp (yes I know) library and am running into an error.  Unfortunately the error that I am getting back is extremely vague but I do know what variable is causing it.  All I would like to do is simply print this variable out to stdout so that I can see what is going on.  However, this variable is not a standard type.  It has the type
 Opt_Int64 someVar = 10;

where
typedef int64_t VosT_int64;
typedef VosT_Int64 OpT_Int64;

For the life of me, I can't figure out how to convert this Opt_Int64 type into a char array so that I can print it out.  I would assume that the following function would do this for me
void int64ToChar(char mesg[], Opt_Int64 num) {
    for(int i = 0; i < 8; i++) mesg[i] = num >> (8-1-i)*8;
}

but it doesn't seem to work (I built a very simple hello world style program to test this).  Either I simply don't understand typedef as well as I should or there must be something wrong with the function above.  Isn't typedef just a way of telling the compiler that you're giving a type a different name?

A:

int64_t is a standard type, defined in stdint.h. You can print it like this:
printf("%" PRId64 "\n", someVar);

The macro PRId64 and its kin are defined in inttypes.h.

