This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Conversion from void double pointer to char array



Hai,

Iam poor at programming..Please help me in converting void double pointer which is a structure member to single dimensional char array.Following is my implementation.Please correc my code if something is wrong..

typedef struct {

tuint srcPort;
tint npkts; /**< Defines the number transmission segments being trasnported */
tint *pktSize; /**< Pointer to segment size array. */
void **pktIn; /**< Pointer to segment entry array */

} xferpktInfo_t;

xferpktInfo_t *Packets;

unsigned char packets[162];

for (i = 0; i < Packets->npkts; i++)
{
      for (j = 0; j < Packets->pktSize[i]; j++)
       {

            packets[j]=(unsigned char) ((unsigned char*)(*(Packets->pktIn+i)))[j];

     }

}

  • In this forum we don't usually discuss C programming errors like this.  I suggest you build a test harness that allows you to run this code on your host system (laptop, Linux machine, etc.).  Debug it that way.  If that doesn't help, there are any number of general C programming web sites which can help.

    Thanks and regards,

    -George