Created
July 11, 2019 20:48
-
-
Save sc268/451c282b98105cc557c180a218ddd9c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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