Click here to Skip to main content
15,887,945 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow does this macro work? Pin
Amrit Kshetri30-Jul-10 16:06
Amrit Kshetri30-Jul-10 16:06 
AnswerRe: how does this macro work? Pin
Paul M Watt30-Jul-10 17:17
mentorPaul M Watt30-Jul-10 17:17 
GeneralRe: how does this macro work? Pin
Amrit Kshetri30-Jul-10 18:46
Amrit Kshetri30-Jul-10 18:46 
GeneralRe: how does this macro work? Pin
Paul M Watt30-Jul-10 19:05
mentorPaul M Watt30-Jul-10 19:05 
Questionheap corruption detected Pin
smengl30-Jul-10 8:38
smengl30-Jul-10 8:38 
AnswerRe: heap corruption detected Pin
Maximilien30-Jul-10 8:52
Maximilien30-Jul-10 8:52 
GeneralRe: heap corruption detected Pin
David Crow30-Jul-10 9:21
David Crow30-Jul-10 9:21 
AnswerRe: heap corruption detected Pin
Chuck O'Toole30-Jul-10 17:24
Chuck O'Toole30-Jul-10 17:24 
You are directly manipulating the internal buffer of CString using GetBuffer(). You are wring some unknown number of characters into it using GetLine(). How do you know the buffer is big enough to contain all that data? Heap corruptions are often caused by "buffer overruns" and this smells like one.

According to the documentation, you need to tell it the size of the buffer you require for direct manipulation by specifying GetBuffer(size_needed) but you don't do that.

In most situations, you should use CString member functions to modify the contents of a CString object or to convert the CString to a C-style character string.

However, there are certain situations, such as working with operating-system functions that require a character buffer, where it is advantageous to directly modify the CString contents.

The GetBuffer and ReleaseBuffer member functions allow you to gain access to the internal character buffer of a CString object and modify it directly. The following steps show how to use these functions for this purpose:

Call GetBuffer for a CString object and specify the length of the buffer you require.

Use the pointer returned by GetBuffer to write characters directly into the CString object.

Call ReleaseBuffer for the CString object to update all the internal CString state information, such as the length of the string. After modifying a CString object's contents directly, you must call ReleaseBuffer before calling any other CString member functions.
AnswerRe: heap corruption detected Pin
Aescleal30-Jul-10 21:03
Aescleal30-Jul-10 21:03 
QuestionAny interest in parallel programming 64-bit multi-core c++? Pin
rob Schultz30-Jul-10 8:35
rob Schultz30-Jul-10 8:35 
AnswerRe: Any interest in parallel programming 64-bit multi-core c++? [modified] Pin
SortaCore1-Aug-10 22:48
SortaCore1-Aug-10 22:48 
AnswerRe: Any interest in parallel programming 64-bit multi-core c++? Pin
rob Schultz6-Aug-10 19:45
rob Schultz6-Aug-10 19:45 
QuestionWAVEINCAPS help... Pin
AmbiguousName30-Jul-10 7:52
AmbiguousName30-Jul-10 7:52 
QuestionCMDIChildWndEx with its own menu Pin
SaintNeil30-Jul-10 5:17
SaintNeil30-Jul-10 5:17 
AnswerRe: CMDIChildWndEx with its own menu Pin
Richard MacCutchan30-Jul-10 6:35
mveRichard MacCutchan30-Jul-10 6:35 
AnswerRe: CMDIChildWndEx with its own menu Pin
Eugen Podsypalnikov30-Jul-10 11:02
Eugen Podsypalnikov30-Jul-10 11:02 
QuestionDisconnect from server in vc++ Pin
dilara semerci30-Jul-10 3:45
dilara semerci30-Jul-10 3:45 
AnswerRe: Disconnect from server in vc++ Pin
Moak30-Jul-10 4:21
Moak30-Jul-10 4:21 
AnswerRe: Disconnect from server in vc++ Pin
Cool_Dev30-Jul-10 4:33
Cool_Dev30-Jul-10 4:33 
QuestionRe: Disconnect from server in vc++ Pin
dilara semerci2-Aug-10 4:38
dilara semerci2-Aug-10 4:38 
AnswerRe: Disconnect from server in vc++ Pin
Cool_Dev2-Aug-10 18:01
Cool_Dev2-Aug-10 18:01 
QuestionC4309 warning Pin
Rakesh530-Jul-10 3:45
Rakesh530-Jul-10 3:45 
AnswerRe: C4309 warning Pin
Cedric Moonen30-Jul-10 3:52
Cedric Moonen30-Jul-10 3:52 
GeneralRe: C4309 warning Pin
Rakesh530-Jul-10 4:10
Rakesh530-Jul-10 4:10 
GeneralRe: C4309 warning Pin
Chris Losinger30-Jul-10 4:12
professionalChris Losinger30-Jul-10 4:12 

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.