J
James DeClerk
Hi everyone.
I'm new to C++ and I've got a seemingly tough problem to tackle.
I have a union. This union needs to be converted into hexadecimal
format. The hexadecimal number is then inserted into a Binary (255)
column in a SQL Server DB. The program will be complied on the unix
platform using gcc.
union account
{
struct
{
float f_balance;
int i_daysopened;
};
};
Question 1) How would I convert this union to a hexadecimal?
Question 2) Would the hexadecimal best be stored as a data type of
char with a length of 255?
Question 3) Once converted to a hexadecimal, how would I recast it
back in to a union? Would it simply be something like:
//x is the char[255] of the hex number
account new_acct;
new_acct = (account) x;
Or is there a more elaborate way of doing this. Any help would be much
appreciated.
Thanks
I'm new to C++ and I've got a seemingly tough problem to tackle.
I have a union. This union needs to be converted into hexadecimal
format. The hexadecimal number is then inserted into a Binary (255)
column in a SQL Server DB. The program will be complied on the unix
platform using gcc.
union account
{
struct
{
float f_balance;
int i_daysopened;
};
};
Question 1) How would I convert this union to a hexadecimal?
Question 2) Would the hexadecimal best be stored as a data type of
char with a length of 255?
Question 3) Once converted to a hexadecimal, how would I recast it
back in to a union? Would it simply be something like:
//x is the char[255] of the hex number
account new_acct;
new_acct = (account) x;
Or is there a more elaborate way of doing this. Any help would be much
appreciated.
Thanks