Resizing a char[x] to char[y] at runtime

后端 未结 11 1119
我在风中等你
我在风中等你 2021-02-11 01:33

OK, I hope I explain this one correctly. I have a struct:

typedef struct _MyData
{
   char Data[256];
   int  Index;
} MyData;

Now, I run into

11条回答
  •  执念已碎
    2021-02-11 01:46

    You don't state what the Index value is for.

    As I understand it you are passing data to another program using the structure shown. Is there a reason why you can't break your data to send into chunks of 256bytes and then set the index value accordingly? e.g.

    Data is 512 bytes so you send one struct with the first 256 bytes and index=0, then another with the next 256 bytes in your array and Index=1.

提交回复
热议问题