Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ Function objects - how to use them? Pin
kuhx198011-May-03 4:16
kuhx198011-May-03 4:16 
GeneralMenu sharing in MDI application with 2 document templates Pin
Jayanta Basu8-May-03 2:27
Jayanta Basu8-May-03 2:27 
Questionwriting data to a text file????????? Pin
xxhimanshu8-May-03 1:43
xxhimanshu8-May-03 1:43 
AnswerRe: writing data to a text file????????? Pin
Nitron8-May-03 1:55
Nitron8-May-03 1:55 
QuestionCan someone help, im new to C++ Pin
mawmany2k8-May-03 1:30
mawmany2k8-May-03 1:30 
AnswerRe: Can someone help, im new to C++ Pin
Stephane Rodriguez.8-May-03 1:33
Stephane Rodriguez.8-May-03 1:33 
AnswerRe: Can someone help, im new to C++ Pin
Hari Krishnan (Noida)8-May-03 2:17
Hari Krishnan (Noida)8-May-03 2:17 
GeneralMemory Leak Pin
saravanaram8-May-03 1:09
saravanaram8-May-03 1:09 
Hi all,
in mfc dialog based application i have the following function.

void Reverse()
{
// TODO: Add your control notification handler code here
int nIndex, nStrLength, nWordIndex;
TCHAR *pStrWord, *pStrFinal, ch;

UpdateData(TRUE);

nStrLength = m_strInput.GetLength();

pStrWord = new TCHAR [nStrLength + 1];
pStrFinal = new TCHAR [nStrLength + 1];
*pStrWord = '\0';
*pStrFinal = '\0';
nWordIndex = 0;

for (nIndex = 0;nIndex < nStrLength; nIndex++)
{

ch = m_strInput.GetAt(nIndex);
if ( ch != ' ' || nIndex == nStrLength )
{
pStrWord[nWordIndex] = m_strInput.GetAt(nIndex);
nWordIndex++;
}

if ( ch == ' ' )
{
pStrWord[nWordIndex++] = ' ';
pStrWord[nWordIndex] = '\0';
_tcscat(pStrFinal,_tcsrev(pStrWord));
nWordIndex=0;
}

if ( nIndex == (nStrLength - 1) )
{
pStrWord[nWordIndex++] = ' ';
pStrWord[nWordIndex] = '\0';
_tcscat(pStrFinal,_tcsrev(pStrWord));
nWordIndex = 0;
}
}
pStrFinal = _tcsrev(pStrFinal);
pStrFinal[nStrLength] = '\0';
m_strOutput = pStrFinal;
UpdateData(FALSE);

delete [] pStrWord;
delete [] pStrFinal;
}


I get error when deleting pStrFinal could anyone tell me why this happens. can any one of you explain me how to dump memory and to verify it.
GeneralRe: Memory Leak Pin
Stephane Rodriguez.8-May-03 1:31
Stephane Rodriguez.8-May-03 1:31 
GeneralRe: Memory Leak Pin
Hari Krishnan (Noida)8-May-03 2:47
Hari Krishnan (Noida)8-May-03 2:47 
GeneralRe: Memory Leak Pin
David Crow8-May-03 3:14
David Crow8-May-03 3:14 
GeneralRe: Memory Leak Pin
Hari Krishnan (Noida)8-May-03 4:13
Hari Krishnan (Noida)8-May-03 4:13 
GeneralRe: Memory Leak Pin
David Crow8-May-03 4:26
David Crow8-May-03 4:26 
GeneralPassing around params VC++6.0 VC# Pin
NHM8-May-03 0:50
NHM8-May-03 0:50 
GeneralRe: Passing around params VC++6.0 VC# Pin
Stephane Rodriguez.8-May-03 1:01
Stephane Rodriguez.8-May-03 1:01 
GeneralRe: Passing around params VC++6.0 VC# Pin
NHM8-May-03 1:19
NHM8-May-03 1:19 
GeneralRe: Passing around params VC++6.0 VC# Pin
Stephane Rodriguez.8-May-03 1:29
Stephane Rodriguez.8-May-03 1:29 
GeneralRe: Passing around params VC++6.0 VC# Pin
NHM8-May-03 3:18
NHM8-May-03 3:18 
GeneralRe: Passing around params VC++6.0 VC# Pin
Stephane Rodriguez.8-May-03 3:29
Stephane Rodriguez.8-May-03 3:29 
GeneralRe: Passing around params VC++6.0 VC# Pin
NHM8-May-03 3:45
NHM8-May-03 3:45 
GeneralRe: Passing around params VC++6.0 VC# Pin
Stephane Rodriguez.8-May-03 3:51
Stephane Rodriguez.8-May-03 3:51 
GeneralWS_CLIPSIBLINGS......... Pin
Neha8-May-03 0:15
Neha8-May-03 0:15 
GeneralRe: WS_CLIPSIBLINGS......... Pin
jhaga8-May-03 2:59
professionaljhaga8-May-03 2:59 
GeneralCFile Pin
macmac387-May-03 23:19
macmac387-May-03 23:19 
GeneralRe: CFile Pin
Neville Franks8-May-03 0:08
Neville Franks8-May-03 0:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.