vendredi 8 mai 2015

How to add data dynamically in structure which is a Pointer to an array of pointers

I have two structure as below:

typdef struct abc
{
   int id;
   char name;
}s_abc,*lpabc;
typdef struct result
{
    int acc_no;
    lpabc *details;
}s_res;

I need to dynamically add the data within the structure result which points out to an array of pointers ie: struct abc The structure abc could be an array of 5 values for eg. How should i add the values ?

the structure defined are explicit: For better understanding i'm attaching the structure below:-

typedef struct _wfs_cdm_physicalcu
{
    LPSTR                 lpPhysicalPositionName;
    CHAR                  cUnitID[5];
    ULONG                 ulInitialCount;
    ULONG                 ulCount;
    ULONG                 ulRejectCount;
    ULONG                 ulMaximum;
    USHORT                usPStatus;
    BOOL                  bHardwareSensor; 
 } WFSCDMPHCU, *LPWFSCDMPHCU;

typedef struct _wfs_cdm_cashunit
{
    USHORT                usNumber;
    USHORT                usType;
    LPSTR                 lpszCashUnitName;
    CHAR                  cUnitID[5];
    CHAR                  cCurrencyID[3];
    BOOL                  bAppLock;
    USHORT                usStatus;
    USHORT                usNumPhysicalCUs;
    LPWFSCDMPHCU         *lppPhysical;

} WFSCDMCASHUNIT, *LPWFSCDMCASHUNIT;
typedef struct _wfs_cdm_cu_info
{
    USHORT                usTellerID;
    USHORT                usCount;
    LPWFSCDMCASHUNIT *lppList;
} WFSCDMCUINFO, *LPWFSCDMCUINFO;

Here i need to access the data of _wfs_cdm_physicalcu 4 times ie : an array.

Aucun commentaire:

Enregistrer un commentaire