Re: store contents of structure into an array



hi eric,
thanx for the suggestion, i was exactly looking for sth like that
only, though i never thought that i could do casting on the lhs also. i
do understand the issues raised by you. but i suppose if portability is
not a big issue, its quite okay to make such assumptions. so, if u take
a little care and define your structure such that you know that you
will not run into alignment problems then it okay, right?
as for what i am trying to do. well, primarily i was just bogged
down by this issue, for i knew that there ought to be a oneline
solution to getting this done, but i was not able to think of it
myself.
i am reading a SD card through a microprocessor. so, i basically
read data in chunks of 512 bytes into a buffer and dump them to a
structure so that i can easily acess the various fields in the data
which i was already able to do. but then i needed to make some changes
and put it back into the buffer, thats where i got stuck.
thanx again for the help, i was just not happy with the memcpy
solution, even though it was a oneliner.
regards,
ash

.



Relevant Pages