Click here to Skip to main content
15,900,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to modify LPCTSTR contet? Pin
bosfan14-Sep-06 23:16
bosfan14-Sep-06 23:16 
AnswerRe: How to modify LPCTSTR contet? Pin
Nibu babu thomas14-Sep-06 23:18
Nibu babu thomas14-Sep-06 23:18 
GeneralRe: How to modify LPCTSTR contet? Pin
Andrei Muraru15-Sep-06 1:09
Andrei Muraru15-Sep-06 1:09 
GeneralRe: How to modify LPCTSTR contet? Pin
Stephen Hewitt15-Sep-06 1:24
Stephen Hewitt15-Sep-06 1:24 
GeneralRe: How to modify LPCTSTR contet? Pin
Stephen Hewitt15-Sep-06 1:27
Stephen Hewitt15-Sep-06 1:27 
GeneralRe: How to modify LPCTSTR contet? Pin
Nibu babu thomas15-Sep-06 1:42
Nibu babu thomas15-Sep-06 1:42 
GeneralRe: How to modify LPCTSTR contet? Pin
bosfan15-Sep-06 3:04
bosfan15-Sep-06 3:04 
GeneralRe: How to modify LPCTSTR contet? Pin
Stephen Hewitt16-Sep-06 1:28
Stephen Hewitt16-Sep-06 1:28 
GetBuffer returns a non-const pointer. Make your code look like this:
LPTSTR lpsz = csContent.GetBuffer(100);
// Do stuff...
csContent.ReleaseBuffer();


You don't need to have a LPCTSTR which you cast to LPSTR; this is strange and confusing to say the least. Also note that you need to call ReleaseBuffer and that GetBuffer takes a minimum buffer size parameter.

You should not be calling GetBuffer at all however: this is designed when you need to manipulate the contents of a CString with code that doesn't know anything about CStrings. If your writing code to manipulate the CString you should use its member functions. Why use a string wrapper if you're just going to get a pointer to the underlying buffer and manipulate it directly?

What exactly are you tring to do?



Steve

AnswerRe: How to modify LPCTSTR content? Pin
bosfan15-Sep-06 2:04
bosfan15-Sep-06 2:04 
GeneralRe: How to modify LPCTSTR content? Pin
Zac Howland15-Sep-06 3:51
Zac Howland15-Sep-06 3:51 
GeneralRe: How to modify LPCTSTR content? Pin
bosfan15-Sep-06 6:54
bosfan15-Sep-06 6:54 
GeneralRe: How to modify LPCTSTR content? Pin
Zac Howland15-Sep-06 9:08
Zac Howland15-Sep-06 9:08 
QuestionDisplaying continous values Pin
Pratheep Kenny14-Sep-06 22:56
Pratheep Kenny14-Sep-06 22:56 
AnswerRe: Displaying continous values Pin
Rinu_Raj14-Sep-06 23:01
Rinu_Raj14-Sep-06 23:01 
QuestionProblem with fonts in DC ? Pin
Vinod Sankaranarayanan14-Sep-06 22:49
Vinod Sankaranarayanan14-Sep-06 22:49 
AnswerRe: Problem with fonts in DC ? Pin
kk.tvm14-Sep-06 22:52
kk.tvm14-Sep-06 22:52 
AnswerRe: Problem with fonts in DC ? Pin
Steve S14-Sep-06 22:52
Steve S14-Sep-06 22:52 
AnswerRe: Problem with fonts in DC ? Pin
Hamid_RT15-Sep-06 7:26
Hamid_RT15-Sep-06 7:26 
QuestionLinking Error when use Class Template in VC6 [modified] Pin
Andy Rama14-Sep-06 20:42
Andy Rama14-Sep-06 20:42 
AnswerRe: Linking Error when use Class Template in VC6 [modified] Pin
Mr.Brainley14-Sep-06 21:48
Mr.Brainley14-Sep-06 21:48 
AnswerRe: Linking Error when use Class Template in VC6 Pin
Nibu babu thomas14-Sep-06 21:56
Nibu babu thomas14-Sep-06 21:56 
GeneralRe: Linking Error when use Class Template in VC6 Pin
Andy Rama14-Sep-06 22:09
Andy Rama14-Sep-06 22:09 
GeneralRe: Linking Error when use Class Template in VC6 Pin
Nibu babu thomas14-Sep-06 22:19
Nibu babu thomas14-Sep-06 22:19 
GeneralRe: Linking Error when use Class Template in VC6 Pin
Andy Rama14-Sep-06 22:44
Andy Rama14-Sep-06 22:44 
GeneralRe: Linking Error when use Class Template in VC6 Pin
Nibu babu thomas14-Sep-06 22:46
Nibu babu thomas14-Sep-06 22:46 

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.