I have been able to get my program to compile, but it errors out when I try to run it. I'm trying to pass
a linked-list structure to another function. PKADEN is
the function that needs to recieve "*Saved".
The call to EV_Num from PKADEN:
EV_Num is declared in a header named SMILES.H:
Additionally, the following struct is delcared in Smiles.h:
EV_Num resides in eval.cpp. There is another struct set before the EV_Num function:
The EV_Num function:
Here's what I would like to do on PKADEN, but not having any luck, I've trimmed out some code to get more to the point:
a linked-list structure to another function. PKADEN is
the function that needs to recieve "*Saved".
The call to EV_Num from PKADEN:
Code:
alist* pSaved = NULL;
N_Frag = EV_Num(PKAGroupFrag, m, &r,MAXLEV,pSaved);
EV_Num is declared in a header named SMILES.H:
Code:
int EV_Num(char *, MOLECULE *, RINGS *,int& MAXLEV, struct alist *pLinkList);
Code:
static struct alist { /* Nodes of linked list: Paths */
int *p; /* Array of paths */
struct alist *Next; /* Next path */
};
Code:
static struct alist **Saved; /* Saved paths */
The EV_Num function:
Code:
int EV_Num(char *s, MOLECULE *m, RINGS *r,int& MAXLEV,alist* pLinkList)
{
int i;
int K_Frag, K_Chem;
int *pMAXLEV = &MAXLEV;
//allocate a new node
Saved = (struct alist **) malloc(sizeof(struct alist*));
*Saved = (struct alist *)NULL; /* Linked list of saved paths */
//GetPath adds nodes to the list
GetPath( m, r ); /* Get the paths */
pLinkList = *Saved;//I've added this, but doesn't work
Here's what I would like to do on PKADEN, but not having any luck, I've trimmed out some code to get more to the point:
Code:
int pkaden(char *s, char *ErrorMsg, char *PKADetail, double& FinalPKA, int ShowDetails)
{
alist* pSaved = NULL;
N_Frag = EV_Num(PKAGroupFrag, m, &r,MAXLEV,pSaved);
struct alist *t;
while ( *pSaved != NULL ) {
t = *pSaved;
myfile << "Got Here\n";
for ( i = 0; i < Max_Level; i++ ){
myfile << t->p[i];
}
*pSaved = t->Next;
}