Solved

INSUFFICIENT_BUFFER when use CString::GetBuffer(dwSize) & CString::ReleaseBuffer()

Posted on 1998-09-07
2
366 Views
Last Modified: 2013-11-20
When I use CString::GetBuffer(dwSize) & CString::ReleaseBuffer(), I often encount such problem of INSUFFICIENT BUFFER. May you help me and tell me why?
Thank you very much!
0
Comment
Question by:happy050597
2 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1321865
Where did you get this error? Did it throw a CMemoryException? What's the value of dwSize?
0
 
LVL 1

Accepted Solution

by:
subbaiah earned 50 total points
ID: 1321866
If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before using any other CString member functions.

The address returned by GetBuffer may not be valid after the call to ReleaseBuffer since additional CString operations may cause the CString buffer to be reallocated. The buffer will not be reallocated if you do not change the length of the CString.

The buffer memory will be freed automatically when the CString object is destroyed.


0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 35
Doc'in system (example?) BA 7 79
countEvens challenge 2 59
post4 challenge 28 83
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now