C to C++ arrays and back again
I've got a large library written in C that I'm writing C++ around.
I've got a static C array defined in a header file
1 2 3 4 5
|
#define REG_TABLE {{0x9C, 0xA1}, \
{0xBA, 0xFD}, \
{0x7C, 0x2B}, \
{0x6C, 0xe6}, \
{0x6d, 0x01}}
|
and I want to put it into
1 2 3 4 5 6 7
|
typedef struct
{
Uint8T reg; /// register affected
Uint8T val; /// value to set
}reg_t;
reg_t *tbl = new reg_t[REG_TABLE_SZ];
|
Uint8T
is an
unsigned char
I know I can declare a C style array to do it
|
reg_t reg_table[REG_TABLE_SZ] = REG_TABLE;
|
Anyone got any bright ideas for doing it into a C++ array without a loop or memcpy()?
This will eventually be passed to a C library function.
Topic archived. No new replies allowed.