Click here to Skip to main content
15,899,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDll used by app Pin
garfield1855-Jun-07 4:52
garfield1855-Jun-07 4:52 
AnswerRe: Dll used by app Pin
David Crow5-Jun-07 5:39
David Crow5-Jun-07 5:39 
GeneralRe: Dll used by app Pin
garfield1855-Jun-07 6:20
garfield1855-Jun-07 6:20 
QuestionCasts Pin
tom groezer5-Jun-07 2:18
tom groezer5-Jun-07 2:18 
AnswerRe: Casts Pin
Nibu babu thomas5-Jun-07 2:35
Nibu babu thomas5-Jun-07 2:35 
AnswerRe: Casts Pin
Rajkumar R5-Jun-07 2:37
Rajkumar R5-Jun-07 2:37 
AnswerRe: Casts Pin
jhwurmbach5-Jun-07 2:42
jhwurmbach5-Jun-07 2:42 
AnswerRe: Casts Pin
Matthew Faithfull5-Jun-07 2:42
Matthew Faithfull5-Jun-07 2:42 
Thr trite answer is, that depends on what the function wants to do with the LPSTR. Smile | :)

You can call mycstring.GetBuffer(0); to get a pointer to the internal text buffer in the CString object. If you're working in ASCII and not UNICODE then that pointer should match up with LPSTR. If the function you're calling expects the string to be of at least a minimum length then use mycstring.GetBuffer(nMinLength); to get a buffer of at least nMinLength characters. If doing this actually makes your CString longer you can call <code>mycstring.ReleaseBuffer(); afterwards to let the buffer shrink to only what's needed.
If the function that takes a LPSTR wants to write into the string you have to be very careful to pass a big enough buffer and validate it afterwards. mycstring.GetBufferSetLength(nLength); can sometimes be useful for this sort of thing. CStrings are useful but slippery customers Wink | ;)

Nothing is exactly what it seems but everything with seems can be unpicked.

AnswerRe: Casts Pin
CPallini5-Jun-07 2:42
mveCPallini5-Jun-07 2:42 
AnswerRe: Casts Pin
Paresh Chitte5-Jun-07 2:58
Paresh Chitte5-Jun-07 2:58 
QuestionRe: Casts Pin
David Crow5-Jun-07 3:12
David Crow5-Jun-07 3:12 
AnswerRe: Casts Pin
Nelek5-Jun-07 2:59
protectorNelek5-Jun-07 2:59 
GeneralRe: Casts Pin
CPallini5-Jun-07 3:14
mveCPallini5-Jun-07 3:14 
GeneralRe: Casts Pin
Nelek6-Jun-07 6:57
protectorNelek6-Jun-07 6:57 
GeneralRe: Casts Pin
jhwurmbach6-Jun-07 7:08
jhwurmbach6-Jun-07 7:08 
GeneralRe: Casts Pin
CPallini6-Jun-07 9:59
mveCPallini6-Jun-07 9:59 
GeneralRe: Casts Pin
Nelek8-Jun-07 6:20
protectorNelek8-Jun-07 6:20 
GeneralRe: Casts Pin
jhwurmbach5-Jun-07 23:27
jhwurmbach5-Jun-07 23:27 
GeneralRe: Casts Pin
Nelek6-Jun-07 6:59
protectorNelek6-Jun-07 6:59 
GeneralRe: Casts Pin
jhwurmbach6-Jun-07 7:02
jhwurmbach6-Jun-07 7:02 
AnswerRe: Casts Pin
Paresh Chitte5-Jun-07 3:01
Paresh Chitte5-Jun-07 3:01 
JokeRe: Casts Pin
CPallini5-Jun-07 3:15
mveCPallini5-Jun-07 3:15 
GeneralRe: Casts Pin
#realJSOP5-Jun-07 3:59
professional#realJSOP5-Jun-07 3:59 
GeneralRe: Casts Pin
Stephen Hewitt5-Jun-07 14:38
Stephen Hewitt5-Jun-07 14:38 
GeneralRe: Casts Pin
jhwurmbach5-Jun-07 23:31
jhwurmbach5-Jun-07 23:31 

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.