Struct Padding

后端 未结 6 455
忘掉有多难
忘掉有多难 2021-01-23 00:09

I am trying to read chunks of data from a file directly into a struct but the padding is causing too much data to be read and the data to be misaligned.

Do I have to man

6条回答
  •  情话喂你
    2021-01-23 00:33

    If you are using a Microsoft compiler then explore the align pragma. There are also the alignment include files:

    #include 
    // your code here
    #include 
    

    GNU gcc has a different system that allows you to add alignment/padding to the structure definition.

提交回复
热议问题