Tuesday, November 4, 2008

Structure to Structure copy

from :
http://forums.devx.com/archive/index.php/t-92711.html


why aren't you using plain assignment? C supports struct assignment:

struct A
{
int a;
float b;
char c;
long m;
};

struct A a;
struct A b;
b=a; /* works with ANSI C too*/

Danny
www.exontrol.com
10-09-2001, 05:52 PM
You can use memcpy(&a,&b, sizeof(yourstruct)), but if it contains strings,
or pointers, you have to copy individually that members,

Mike
www.exontrol.com

No comments: