Re: Copying a struct to a larger struct?
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 28 Jul 2005 15:13:44 GMT
"hermes_917@xxxxxxxxx" wrote:
>
> I want to use memcpy to copy the contents of one struct to another
> which is a superset of the original struct (the second struct has
> extra members at the end). I wrote a small program to test this,
> and it seems to work fine, but are there any cases where doing
> something like this could cause any problems?
Why do snaky things in the first place? Just write down what you
want:
struct smaller {
....
} smallguy;
struct bigger {
struct smaller small;
....
} bigguy;
....
bigguy.small = smallguy;
and I find it hard to imagine what could go wrong.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
.
- Follow-Ups:
- Re: Copying a struct to a larger struct?
- From: Randy Howard
- Re: Copying a struct to a larger struct?
- References:
- Copying a struct to a larger struct?
- From: hermes_917@xxxxxxxxx
- Copying a struct to a larger struct?
- Prev by Date: Re: Use of 'extern' keyword
- Next by Date: Re: Use of 'extern' keyword
- Previous by thread: Re: Copying a struct to a larger struct?
- Next by thread: Re: Copying a struct to a larger struct?
- Index(es):
Relevant Pages
|