Click here to Skip to main content
15,910,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
RantRe: Convert CString to const char * PinPopular
toxcct21-Oct-08 1:26
toxcct21-Oct-08 1:26 
AnswerRe: Convert CString to const char * Pin
Cedric Moonen21-Oct-08 0:19
Cedric Moonen21-Oct-08 0:19 
GeneralRe: Convert CString to const char * Pin
SandipG 21-Oct-08 1:08
SandipG 21-Oct-08 1:08 
GeneralRe: Convert CString to const char * Pin
dehseth21-Oct-08 1:42
dehseth21-Oct-08 1:42 
AnswerRe: Convert CString to const char * Pin
Le@rner21-Oct-08 1:55
Le@rner21-Oct-08 1:55 
GeneralRe: Convert CString to const char * Pin
toxcct21-Oct-08 2:00
toxcct21-Oct-08 2:00 
GeneralRe: Convert CString to const char * Pin
Cedric Moonen21-Oct-08 2:04
Cedric Moonen21-Oct-08 2:04 
QuestionRe: Convert CString to const char * Pin
CPallini21-Oct-08 2:40
mveCPallini21-Oct-08 2:40 
"_$h@nky_" wrote:
//CString to char pointer
1.
CString MyString = "ABCDEF";
char * szMyString = (char *) (LPCTSTR) MyString;

2.
char *pBuffer = new char[1024];
CString strBuf = "Test";
pBuffer = strBuf.GetBuffer(sizeof(pBuffer));


Why not
3. 
char *pBuffer; 
CString strBuf = "Test";
pBuffer = (char *) &strBuf;


to go out with a bang?
Big Grin | :-D

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

AnswerRe: Convert CString to const char * Pin
Mark Salsbery21-Oct-08 5:03
Mark Salsbery21-Oct-08 5:03 
AnswerRe: Convert CString to const char * Pin
Alan Balkany21-Oct-08 4:04
Alan Balkany21-Oct-08 4:04 
NewsRe: Convert CString to const char * Pin
Roger Stoltz21-Oct-08 5:53
Roger Stoltz21-Oct-08 5:53 
QuestionWindows Firewall exception Pin
Krishnakumartg20-Oct-08 23:55
Krishnakumartg20-Oct-08 23:55 
AnswerRe: Windows Firewall exception Pin
Saurabh.Garg21-Oct-08 1:18
Saurabh.Garg21-Oct-08 1:18 
AnswerRe: Windows Firewall exception Pin
User 21559721-Oct-08 1:35
User 21559721-Oct-08 1:35 
QuestionCOM dll registration Pin
Krishnakumartg20-Oct-08 23:44
Krishnakumartg20-Oct-08 23:44 
AnswerRe: COM dll registration Pin
Iain Clarke, Warrior Programmer21-Oct-08 0:05
Iain Clarke, Warrior Programmer21-Oct-08 0:05 
GeneralRe: COM dll registration Pin
Krishnakumartg21-Oct-08 0:26
Krishnakumartg21-Oct-08 0:26 
AnswerRe: COM dll registration Pin
Roger Stoltz21-Oct-08 0:16
Roger Stoltz21-Oct-08 0:16 
GeneralRe: COM dll registration Pin
Krishnakumartg21-Oct-08 0:28
Krishnakumartg21-Oct-08 0:28 
GeneralRe: COM dll registration Pin
Iain Clarke, Warrior Programmer21-Oct-08 1:05
Iain Clarke, Warrior Programmer21-Oct-08 1:05 
AnswerRe: COM dll registration Pin
Roger Stoltz21-Oct-08 2:13
Roger Stoltz21-Oct-08 2:13 
QuestionInterface not registered Pin
CodingLover20-Oct-08 23:36
CodingLover20-Oct-08 23:36 
AnswerRe: Interface not registered Pin
Iain Clarke, Warrior Programmer21-Oct-08 0:07
Iain Clarke, Warrior Programmer21-Oct-08 0:07 
QuestionRe: Interface not registered Pin
Roger Stoltz21-Oct-08 0:10
Roger Stoltz21-Oct-08 0:10 
NewsRe: Interface not registered Pin
CodingLover21-Oct-08 2:40
CodingLover21-Oct-08 2:40 

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.