Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionInfo about a file without using windows-needing functions Pin
cuesdean florin16-May-08 4:36
cuesdean florin16-May-08 4:36 
RantRe: Info about a file without using windows-needing functions Pin
toxcct16-May-08 4:56
toxcct16-May-08 4:56 
AnswerRe: Info about a file without using windows-needing functions Pin
Matthew Faithfull16-May-08 5:03
Matthew Faithfull16-May-08 5:03 
AnswerRe: Info about a file without using windows-needing functions Pin
David Crow16-May-08 5:04
David Crow16-May-08 5:04 
AnswerRe: Info about a file without using windows-needing functions Pin
Hamid_RT16-May-08 7:33
Hamid_RT16-May-08 7:33 
Questiondelete operator Pin
iayd16-May-08 4:30
iayd16-May-08 4:30 
AnswerRe: delete operator Pin
toxcct16-May-08 4:34
toxcct16-May-08 4:34 
AnswerRe: delete operator Pin
Cedric Moonen16-May-08 4:39
Cedric Moonen16-May-08 4:39 
Woaw, that's very bad code Dead | X|
First, you allocate a buffer of 22 characters and tries to assign 22 characters in it (you didn't take into consideration the terminating zero).

BUT, you in fact don't copy the string into your buffer. You simply just assign a pointer into wFile (your string is in fact a pointer). Later you try to delete this pointer, which of course will fail because your string was not allocated on the heap (not allocated with new).

So, two things to take into consideration:
1) Always make your buffer 1 place larger to be able to store the null-terminating zero
2) Use strcpy whenever you want to copy a string. This will copy the contents of your string and not simply make a pointer assignement.

Cédric Moonen
Software developer

Charting control [v1.4]

AnswerRe: delete operator Pin
jeron116-May-08 4:40
jeron116-May-08 4:40 
AnswerRe: delete operator [modified] Pin
CPallini16-May-08 4:42
mveCPallini16-May-08 4:42 
AnswerRe: delete operator Pin
David Crow16-May-08 5:00
David Crow16-May-08 5:00 
GeneralRe: delete operator Pin
iayd16-May-08 12:41
iayd16-May-08 12:41 
QuestionDebug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus16-May-08 4:01
panzerdivisionmarkus16-May-08 4:01 
AnswerRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
Gary R. Wheeler17-May-08 1:09
Gary R. Wheeler17-May-08 1:09 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus18-May-08 21:35
panzerdivisionmarkus18-May-08 21:35 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
Gary R. Wheeler19-May-08 0:12
Gary R. Wheeler19-May-08 0:12 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus19-May-08 23:30
panzerdivisionmarkus19-May-08 23:30 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
Gary R. Wheeler20-May-08 0:07
Gary R. Wheeler20-May-08 0:07 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus20-May-08 0:57
panzerdivisionmarkus20-May-08 0:57 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus20-May-08 1:14
panzerdivisionmarkus20-May-08 1:14 
GeneralRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
Gary R. Wheeler20-May-08 11:44
Gary R. Wheeler20-May-08 11:44 
AnswerRe: Debug assertion when using AFX_MANAGE_STATE(AfxGetStaticModuleState()) Pin
panzerdivisionmarkus21-May-08 23:03
panzerdivisionmarkus21-May-08 23:03 
Questionproblem in migrating from VC6 to VC2005 Pin
ptr_Electron16-May-08 3:54
ptr_Electron16-May-08 3:54 
AnswerRe: problem in migrating from VC6 to VC2005 Pin
led mike16-May-08 4:17
led mike16-May-08 4:17 
Questionradiobuttons,vc++ Pin
Mohanraj D16-May-08 3:48
Mohanraj D16-May-08 3:48 

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.