Solved

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

Posted on 1998-09-07
2
375 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
sameEnds challenge 3 159
canBalance challenge 34 85
Execute multiple curl cmds with sleep and send output to file 10 97
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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