i have allocated a 2d array,like bellow
char ** interfaceName;
i have used delete [] for all new
its running ok but as soon as i close the dialog box an go to the main dialog box
its shows #2 stack around the variable m_dlg( which is a dialog object????) is corrupted
can any body help me out plz
thanks in advance..
i have done it in vc++
this is the code
Code:
char ** interfaceName;
void CIDLDETAILS :: getInterface(char Buff[],int len) //parses the internal interface from the file
{
int j,k = 0,cnt = 0,count = 0,flag = 0;
char keyword[] = Interface;
int keywordLength = strlen(keyword);
char interfaceNameTemp[60];
interfaceName = new char *[50]; //
for(int i = 0; i < len; i++)
{
for( j = 0 ; j <keywordLength && (keyword[j] == Buff[i+j]); j++)
{
}
if (j == keywordLength)
{
if(Buff[i-1] == SPACE || Buff[i-1] == NEWLINE)
if(Buff[i+j] == SPACE )
{
while(Buff[i+j] != SPACE )
{
i++;
}
while(IsCharAlphaNumeric( Buff[j+i+k+1] ) || Buff[j+i+k+1] == UNDERSCORE)
{
interfaceNameTemp[k] = Buff[j+i+k];
k++;
}
interfaceNameTemp[k] = Buff[j+i+k];
interfaceNameTemp[k+1] = ENDOFARRAY;
count = cnt;
flag = 0;
while(count != 0) //Avoiding the Duplicate Interfaces
{
if((strcmp(interfaceNameTemp,interfaceName[count-1])) == 0)
{
flag = 1;
break;
}
count--;
}
if(flag == 0)
{
interfaceName[cnt] = new char[strlen(interfaceNameTemp)+1]; :confused:
strcpy(interfaceName[cnt],interfaceNameTemp); :confused:
interfaceName[cnt][k+1] = '\0'; :confused:
cnt++;
}
k = 0;
}
}
}
m_InterfaceCount = cnt;
for(int i = 0; i < cnt ; i++)
MessageBox(CString(interfaceName[i]));
for(int i = 0; i < m_InterfaceCount ; i++)
delete[]interfaceName[i]; :confused:
delete []interfaceName; :confused:
}
am trying to parse a file put the internal interface of the idl file
in to the array

