Code:int SaveClientInfo(HWND DialogHandle) { Client Cliente; HWND NameEditBoxHwnd; HWND NameEditBox; char * NameOfFile; char *FileToSave; char *NameOfClient; int iCount; NameEditBoxHwnd=GetDlgItem(DialogHandle, IDC_NOMBRE); iCount=GetWindowTextLength(NameEditBoxHwnd); //we incremente iCount to accomodate for the NULL character NameOfFile=new char [sizeof(iCount)]; GetWindowText(NameEditBoxHwnd,NameOfFile,iCount+1); FileToSave= new char [sizeof(NameOfFile)]; OpenFileName.hwndOwner = NULL; OpenFileName.lpstrFile = NameOfFile; OpenFileName.lpstrFileTitle =FileToSave; OpenFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT ; GetSaveFileName (&OpenFileName); NameEditBox=GetDlgItem(DialogHandle, IDC_NOMBRE); iCount=GetWindowTextLength(NameEditBox); //we incremente iCount to accomodate for the NULL character NameOfClient=new char [sizeof(iCount)]; GetWindowText(NameEditBox,NameOfClient,iCount+1); Cliente.SetName(NameOfClient); ofstream fout(OpenFileName.lpstrFileTitle); fout.write((char*)&Cliente,sizeof Cliente); fout.close(); delete NameOfFile; delete FileToSave; delete NameOfClient; NameOfFile=NULL; FileToSave=NULL; NameOfClient=NULL; /* I am having some serious problems with this stuff upon closing the window the program crashes.... how would I free the pointer memory? delete Pointer; Pointer=NULL; Should I do this here? Remember taht this is called more than once thruout the program I think that it's because I am not freeing memory properly */ return Success; }