Click here to Skip to main content
15,929,210 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: LogonUser() Function Issues Pin
Naveen1-Aug-06 19:56
Naveen1-Aug-06 19:56 
AnswerRe: LogonUser() Function Issues Pin
Programm3r1-Aug-06 20:03
Programm3r1-Aug-06 20:03 
QuestionDLL Issue Pin
0xFEDE1-Aug-06 19:21
0xFEDE1-Aug-06 19:21 
AnswerRe: DLL Issue Pin
Programm3r1-Aug-06 19:29
Programm3r1-Aug-06 19:29 
JokeRe: DLL Issue Pin
Programm3r1-Aug-06 19:49
Programm3r1-Aug-06 19:49 
AnswerRe: DLL Issue Pin
Sarath C1-Aug-06 19:31
Sarath C1-Aug-06 19:31 
AnswerRe: DLL Issue Pin
Naveen1-Aug-06 19:44
Naveen1-Aug-06 19:44 
QuestionRemove from Heap using delete. Pin
HakunaMatada1-Aug-06 19:00
HakunaMatada1-Aug-06 19:00 
I have the following piece of code.

char* strFile = new char[50] ;<br />
CString str( "Hello\nCoders" ) ;<br />
strFile = str.GetBuffer( str.GetLength() );<br />
std::ofstream myfile;<br />
myfile.open ("d:\\example.txt");<br />
myfile << strFile ;<br />
myfile.close() ;<br />
delete[] strFile ;


The program throws a Debug assertion error at delete[] strFile ;. The function throwing the Exception is _CrtIsValidHeapPointer(pUserData).

I was of the impression that creation with new must be followed by cleanup with delete. Seems like I am wrong or I did something wrong in the above code. Can anyone explain?

---
Beer | [beer] Hakuna-Matada Beer | [beer]
It means no worries for the rest of your days...
It's our problem free, Philosophy

<marquee behavior="alternate" scrollamount="5" scrolldelay="50">Jig | [Dance]

AnswerRe: Remove from Heap using delete. Pin
Sarath C1-Aug-06 19:14
Sarath C1-Aug-06 19:14 
GeneralRe: Remove from Heap using delete. Pin
Naveen1-Aug-06 19:24
Naveen1-Aug-06 19:24 
GeneralRe: Remove from Heap using delete. Pin
Sarath C1-Aug-06 19:35
Sarath C1-Aug-06 19:35 
GeneralRe: Remove from Heap using delete. Pin
HakunaMatada1-Aug-06 19:43
HakunaMatada1-Aug-06 19:43 
GeneralRe: Remove from Heap using delete. [modified] Pin
Sarath C1-Aug-06 20:13
Sarath C1-Aug-06 20:13 
GeneralRe: Remove from Heap using delete. Pin
HakunaMatada1-Aug-06 21:18
HakunaMatada1-Aug-06 21:18 
AnswerRe: Remove from Heap using delete. Pin
Steve Echols1-Aug-06 19:25
Steve Echols1-Aug-06 19:25 
GeneralRe: Remove from Heap using delete. Pin
Sarath C1-Aug-06 19:34
Sarath C1-Aug-06 19:34 
GeneralRe: Remove from Heap using delete. Pin
Steve Echols1-Aug-06 20:13
Steve Echols1-Aug-06 20:13 
GeneralRe: Remove from Heap using delete. Pin
Sarath C1-Aug-06 20:14
Sarath C1-Aug-06 20:14 
AnswerRe: Remove from Heap using delete. Pin
Amar Sutar1-Aug-06 19:26
Amar Sutar1-Aug-06 19:26 
AnswerRe: Remove from Heap using delete. Pin
Michael Dunn1-Aug-06 19:29
sitebuilderMichael Dunn1-Aug-06 19:29 
QuestionHow can i provide multlanguage support to my application? Pin
gloriousgopi1-Aug-06 18:55
gloriousgopi1-Aug-06 18:55 
AnswerRe: How can i provide multlanguage support to my application? Pin
Parthi_Appu1-Aug-06 19:03
Parthi_Appu1-Aug-06 19:03 
GeneralRe: How can i provide multlanguage support to my application? Pin
gloriousgopi1-Aug-06 19:10
gloriousgopi1-Aug-06 19:10 
GeneralRe: How can i provide multlanguage support to my application? Pin
Hamid_RT1-Aug-06 19:33
Hamid_RT1-Aug-06 19:33 
AnswerRe: How can i provide multlanguage support to my application? Pin
gloriousgopi1-Aug-06 19:59
gloriousgopi1-Aug-06 19:59 

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.