right what u told me did clear things up BUT still it continues to crash i think i have found the prob its not the realloc its the
Code:
strcat(szBuffer2,szNewBuffer);
because it doesnt get to the second messagebox before it crashs if wont let me put any thing in the szBuffer2 and heres the new code -
Code:
int nMessageLen;
int nPLen;
char szNewBuffer[1024];
char szBuffer[100] = "Ufo Text Messenger v1.00\r\n\r\n";
char* szBuffer2;
void OutputTextToLog(char *p,int error)
{
nMessageLen = GetDlgItemText(hwnd, IDC_MESSAGEAREA, szNewBuffer, 1024);
nPLen = strlen(p);
realloc(szBuffer2, nMessageLen+nPLen+10);
MessageBox(0,"1",0,0);
strcat(szBuffer2,szNewBuffer);
MessageBox(0,"2",0,0);
strcat(szBuffer2,p);
if((error != -1 ) || (error != SOCKET_ERROR)){
strcat(szBuffer2, "OK\r\n");
}else{
strcat(szBuffer2, "Failed\r\n");
}
SetDlgItemText(hwnd, IDC_MESSAGEAREA, szBuffer2);
}
PLEASE HELP THIS HAS BEEN DRIVING ME MAD!!!!!!!!!!!! MAD!!!!!!!!!!!! AND ITS SLOWING ME DOWN
thx in advance