Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sc268
Created July 11, 2019 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sc268/451c282b98105cc557c180a218ddd9c3 to your computer and use it in GitHub Desktop.
Save sc268/451c282b98105cc557c180a218ddd9c3 to your computer and use it in GitHub Desktop.
struct AMG_ANGLES {
float yaw;
float pitch;
float roll;
};
int main() {
AMG_ANGLES struct_data;
struct_data.yaw = 87.96;
struct_data.pitch = -114.58;
struct_data.roll = 100.50;
//Sending Side
char b[sizeof(struct_data)];
memcpy(b, &struct_data, sizeof(struct_data));
//Receiving Side
AMG_ANGLES tmp; //Re-make the struct
memcpy(&tmp, b, sizeof(tmp));
cout << tmp.yaw; //Display the yaw to see if it's correct
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment