okay i have the following structure in place:
Code:
typedef struct connections connections;
struct connections{ // Structure to contain information about connections to items
int ID; // The identification number of the connected item
float strength; // A float to represent the strength of the connection.
connections * next; // Pointer to the next connection in the list.
};
typedef struct theNode theNode;
struct theNode{ // The main structure that represents an item of Organism or Resource
int id; // The identification number of the item
float levels[ARMAX]; // The array of floats. Limited to 5 indexes
connections * conn; // Pointer to a list of connections
};
all this works fine i assume cause it gives me no errors in other parts of the code, the next section keeps crashing my system
Code:
struct theNode *temp = NULL;
struct connections *tmp = NULL;
int len = 0;
float strength; //Variable used to hold connection strength
switch(message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
len = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDIT_STRENGTH));
if(len > 0)
{
char* buf1;
buf1 = (char*)GlobalAlloc(GPTR, len + 1); //allocate memory
GetDlgItemText(hwnd, IDC_EDIT_STRENGTH, buf1, len + 1);
//call to convertTextToNum function and populate traits array
strength = convertTextToNum(buf1);
GlobalFree((HANDLE)buf1); //free the memory
ConPrintf( hCon,255,"ID # = %d\n", index);//debug
ConPrintf( hCon,255,"Connection ID # = %d\n", index2);//debug
ConPrintf( hCon,255,"Connection Strength = %0.3f\n", strength);//debug
temp = theItems[index];
tmp = temp->conn;
tmp->ID = index2; // <----crashes here in debug when i watch
tmp->strength = strength;
addConnection2(tmp, index); //add connections to organism/resource
}
EndDialog(hwnd, IDOK);
break;
}
break;
default:
return FALSE;
}
return TRUE;
both index and index2 are static ints declared elsewere, i am new to visual studio and am confused by the CXX0030 code that appears when i debug
i hope i explained this and gave enough code
thanx in advance
korbitz