copy structure to unsigned char



Hi,

I need to copy a nested structure (structures having multiple
structures) into a unsigned char
array. I cannot use memcpy as our micro doesnt support it.
I know the way to do is field by field copy of each structure members,
but then is there a
general algo / code which does this field by field copy ???? (Should
not have padding bytes)

My sample structure looks like this ->

struct temp {

struct t1;
struct t2;
struct t3;
...
...
char f[10];
};

I would be grateful if anybody shares me a generic code to do the
above,.

thanks
ravi

.



Relevant Pages

  • [git] m68k
    ... static volatile struct baboon *baboon; ... +static unsigned char baboon_disabled; ... -void baboon_irq_enable(int irq) { ... int baboon_irq_pending ...
    (Linux-Kernel)
  • Re: [RFC] [PATCH 1/1] input/touchscreen: Synaptics Touchscreen Driver
    ... Initial driver for Synaptics touchscreens using RMI4 protocol. ... +struct rmi_function_descriptor { ... unsigned char commandBaseAddr; ...
    (Linux-Kernel)
  • [patch v1.2.35] WAN: add driver retina
    ... static unsigned int find_cnt; ... struct fepci_card_private *cp) ... goto INVALID; ... (unsigned char __user *) ...
    (Linux-Kernel)
  • Re: structure padding
    ... > aggregate data types in order to access the members of the aggregate ... > struct { ...
    (comp.lang.c)
  • Re: Magic structs
    ... unsigned char data; ... It seems to me that a struct Ustr will only occupy 1-byte of memory, ... for the users of the library it looks like a "normal" string API ...
    (comp.lang.c)