Click here to Skip to main content
15,916,398 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: write to a text file Pin
eli1502197914-Dec-04 21:32
eli1502197914-Dec-04 21:32 
GeneralRe: write to a text file Pin
David Crow15-Dec-04 4:20
David Crow15-Dec-04 4:20 
GeneralActive X for other browsers or something similiar Pin
Jsmooth14-Dec-04 17:10
Jsmooth14-Dec-04 17:10 
QuestionHow to reroute connection Pin
Member 38774714-Dec-04 16:17
Member 38774714-Dec-04 16:17 
AnswerRe: How to reroute connection Pin
Ryan Binns14-Dec-04 18:07
Ryan Binns14-Dec-04 18:07 
GeneralWindows Lex/Yacc (and Bumblebee) Pin
maxmaven14-Dec-04 15:01
maxmaven14-Dec-04 15:01 
GeneralRe: Windows Lex/Yacc (and Bumblebee) Pin
Ryan Binns14-Dec-04 18:10
Ryan Binns14-Dec-04 18:10 
QuestionHow to create an installation program for my program? Pin
momer14-Dec-04 15:00
momer14-Dec-04 15:00 
AnswerRe: How to create an installation program for my program? Pin
Larry Antram14-Dec-04 15:08
Larry Antram14-Dec-04 15:08 
GeneralRe: How to create an installation program for my program? Pin
momer14-Dec-04 15:58
momer14-Dec-04 15:58 
GeneralMFC dialog box menu weirdness Pin
Uncle Vance14-Dec-04 14:37
Uncle Vance14-Dec-04 14:37 
QuestionCan some body help me.... Pin
Indra_Putra14-Dec-04 13:34
Indra_Putra14-Dec-04 13:34 
AnswerRe: Can some body help me.... Pin
Maximilien14-Dec-04 14:19
Maximilien14-Dec-04 14:19 
AnswerRe: Can some body help me.... Pin
BRIMID15-Dec-04 1:49
BRIMID15-Dec-04 1:49 
GeneralPrint image with DrawImage in GDI+ Pin
giannibal14-Dec-04 12:36
giannibal14-Dec-04 12:36 
Generalgetting icon Pin
pnpfriend14-Dec-04 11:26
pnpfriend14-Dec-04 11:26 
GeneralRe: getting icon Pin
David Crow15-Dec-04 4:23
David Crow15-Dec-04 4:23 
GeneralReading data from Serial Port. Pin
CNewbie14-Dec-04 10:34
CNewbie14-Dec-04 10:34 
GeneralRe: Reading data from Serial Port. Pin
wwwhb200014-Dec-04 14:00
wwwhb200014-Dec-04 14:00 
GeneralFreeing up memory Pin
poiut14-Dec-04 10:29
poiut14-Dec-04 10:29 
Can someone tell me why this isn't freeing up the memory like it suppose to?

Thanks

#include <afxwin.h>
#include <iostream.h>

class CDeeper : public CObject{
private:
CString *strTemp;
public:
CDeeper():strTemp(new CString){}
~CDeeper(){}
void setStr(CString setTemp){ *strTemp = setTemp; }
void Delete(){ delete strTemp; strTemp = NULL; }
};

class CTest : public CDeeper{
private:
int num;
CObList DeeperList;
CDeeper *pDeeper;
public:
CTest(){}
~CTest(){}
void setStr(int i){
num = i;
pDeeper = new CDeeper;
pDeeper->setStr("Hello");
DeeperList.AddTail(pDeeper);
}

void Delete(){
POSITION pos;
pos = DeeperList.GetHeadPosition();
while(pos){
pDeeper = (CTest *)DeeperList.GetNext(pos);
pDeeper->Delete();
delete pDeeper;
}
DeeperList.RemoveAll();
}
};

int main(){
POSITION pos;
CObList strList;
CTest *pTest;
int i;
for (i=0; i< 50000; i++){
pTest = new CTest;
pTest->setStr(i);
strList.AddTail(pTest);
}
pos = strList.GetHeadPosition();
while(pos){
pTest = (CTest *)strList.GetNext(pos);
pTest->Delete();
delete pTest;
}
strList.RemoveAll();
return 0;
}
GeneralRe: Freeing up memory Pin
David Crow15-Dec-04 2:05
David Crow15-Dec-04 2:05 
GeneralRe: Freeing up memory Pin
poiut15-Dec-04 6:28
poiut15-Dec-04 6:28 
GeneralRe: Freeing up memory Pin
poiut15-Dec-04 6:34
poiut15-Dec-04 6:34 
GeneralMFC File Input and Output problem Pin
Member 158681214-Dec-04 10:25
Member 158681214-Dec-04 10:25 
GeneralCHtmlView + focus Pin
iifisher14-Dec-04 10:21
iifisher14-Dec-04 10:21 

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.