J
Jake Thompson
Hello
I have the following defined structure
struct cm8linkstruc
{
char *type; /* type of item*/
char *desc; /* description of item */
char *item_increment; /* increment value for item in
folder */
char *itemid; /* id of returned item */
int count; /*total count of array */
};
In the function I have this
struct cm8linkstruc **cm8link;
If I want to allocate 50 occurrences of this array then if the
following correct? It appears to be correct at least at a compile level
because it compiles
/*Allocate the array for use over in the dll */
cm8link = (struct cm8linkstruc **) malloc(50 * sizeof(struct
cm8linkstruc *));
for(h = 0; h< 50 ; h++)
{
cm8link[h] = (struct cm8linkstruc *) malloc(sizeof(struct
cm8linkstruc));
cm8link[h]->type = 0;
cm8link[h]->desc = 0;
cm8link[h]->item_increment = 0;
cm8link[h]->itemid = 0;
cm8link[h]->count = 0;
}
I have a function in a dll that will add values to the array and then
pass the populated array back to the calling exe
If I am on the right track then would I pass &cm8link to my function in
my dll in order to use it to populate it before I return from the
called function?
Thanks
Jake
I have the following defined structure
struct cm8linkstruc
{
char *type; /* type of item*/
char *desc; /* description of item */
char *item_increment; /* increment value for item in
folder */
char *itemid; /* id of returned item */
int count; /*total count of array */
};
In the function I have this
struct cm8linkstruc **cm8link;
If I want to allocate 50 occurrences of this array then if the
following correct? It appears to be correct at least at a compile level
because it compiles
/*Allocate the array for use over in the dll */
cm8link = (struct cm8linkstruc **) malloc(50 * sizeof(struct
cm8linkstruc *));
for(h = 0; h< 50 ; h++)
{
cm8link[h] = (struct cm8linkstruc *) malloc(sizeof(struct
cm8linkstruc));
cm8link[h]->type = 0;
cm8link[h]->desc = 0;
cm8link[h]->item_increment = 0;
cm8link[h]->itemid = 0;
cm8link[h]->count = 0;
}
I have a function in a dll that will add values to the array and then
pass the populated array back to the calling exe
If I am on the right track then would I pass &cm8link to my function in
my dll in order to use it to populate it before I return from the
called function?
Thanks
Jake