Originally Posted by borisbn Qt Code: Switch view struct MyStruct {int x;int y;};MyStruct s;char buff[ sizeof( MyStruct ) ];memcpy( buf, &s, sizeof( MyStruct ) ); struct MyStruct { int x; int y; }; MyStruct s; char buff[ sizeof( MyStruct ) ]; memcpy( buf, &s, sizeof( MyStruct ) ); To copy to clipboard, switch view to plain text mode isn't it ? hi borisbn, Thanks for replying, i tried the way you told, but it's not working. Is there any way to copy the contents of a structure to an array(of any type)?
struct MyStruct {int x;int y;};MyStruct s;char buff[ sizeof( MyStruct ) ];memcpy( buf, &s, sizeof( MyStruct ) );
struct MyStruct { int x; int y; }; MyStruct s; char buff[ sizeof( MyStruct ) ]; memcpy( buf, &s, sizeof( MyStruct ) );
Forum Rules
Bookmarks