Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- /*
- typedef struct{
- unsigned char a;
- char b;
- int c;
- unsigned int d;
- char e[10];
- }unpacked;
- #pragma pack(1)
- typedef struct{
- unsigned char a;
- char b;
- int c;
- unsigned int d;
- char e[10];
- }packed;
- */
- import "C"
- import (
- "fmt"
- "github.com/davecgh/go-spew/spew"
- )
- func main() {
- unpack := C.unpacked{}
- pack := C.packed{}
- fmt.Println("Printing the structure of the unpacked struct")
- fmt.Printf("%+v\n", unpack)
- fmt.Println("Printing the structure of the packed struct")
- fmt.Printf("%+v\n", pack)
- }
Add Comment
Please, Sign In to add comment