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

后端 未结 11 1122
我在风中等你
我在风中等你 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:43

    How about a really, really simple solution? Could you do:

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

    I have a feeling I know your response will be "No, because the other program I don't have control over expects 256 bytes"... And if that is indeed your answer to my answer, then my answer becomes: this is impossible.

提交回复
热议问题