Hi,

I get an unexpected error when debugging my program which is:

Debug Assertion failed: dbgdel.cpp line:52 Expression: _BLOCK_TYPE_IS_VALID

I searched the net but i couldn't find the solution which applies to my condition.
Here's the part i which think contains the error:

Code:
char* name;
DATA_STRUCT curData;
int id;

id=SendMessage(hListBox,LB_GETCURSEL,NULL,NULL);

name=new char[SendMessage(hListBox,LB_GETTEXTLEN,(WPARAM)id,NULL)+1];
						
SendMessage(hListBox,LB_GETTEXT,(WPARAM)id,(LPARAM)name);
						
curData=ReadData(name,gSelType);
						
SetWindowText(hEditName,curData.name.c_str());
						
SetWindowText(hEditInfo,curData.info.c_str());
						
delete [] name;
Code:
DATA_STRUCT ReadData(char* name,int type)
{
	FILE *file;
	char dir[200]="Data/";
	DATA_STRUCT rc;

	strcat_s(dir,200,typeItems[type]);
	strcat_s(dir,200,"/");
	strcat_s(dir,200, name);
	strcat_s(dir,200,".dat");

	file=fopen(dir,"r");
	fread(&rc,sizeof(DATA_STRUCT),1,file);
	fclose(file);

	return rc;
}
Code:
typedef struct{
	string name;
	string info;
	}DATA_STRUCT;
i thought of putting this into the windows board, but i'm sure there's sth with the c++ part.