Click here to Skip to main content
15,908,834 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString to LPVOID Pin
David Crow1-Aug-06 5:38
David Crow1-Aug-06 5:38 
GeneralRe: CString to LPVOID Pin
EpicYeti1-Aug-06 5:52
EpicYeti1-Aug-06 5:52 
QuestionRe: CString to LPVOID Pin
David Crow1-Aug-06 5:59
David Crow1-Aug-06 5:59 
AnswerRe: CString to LPVOID Pin
EpicYeti1-Aug-06 7:03
EpicYeti1-Aug-06 7:03 
QuestionRe: CString to LPVOID Pin
David Crow1-Aug-06 7:22
David Crow1-Aug-06 7:22 
AnswerRe: CString to LPVOID Pin
EpicYeti1-Aug-06 7:35
EpicYeti1-Aug-06 7:35 
GeneralRe: CString to LPVOID Pin
David Crow1-Aug-06 7:43
David Crow1-Aug-06 7:43 
GeneralRe: CString to LPVOID [modified] Pin
EpicYeti1-Aug-06 9:35
EpicYeti1-Aug-06 9:35 
I finally got it to work.

So the CString::GetBuffer() returns a const wchar_t* not a const char*, I was mistaken. Howerver I could still use the method you suggested:

const wchar_t* data= m_data.GetBuffer();

If I send that into the SendRequest function the wide char data is lost or not converted or something. So I had to convert it to a char*:

const wchar_t* data= m_data.GetBuffer();
m_data.ReleaseBuffer();

char* Cdata;
Cdata = new char[m_data.GetLength()+1];
size_t num=m_data.GetLength();

wcstombs_s(&num, Cdata, num+1, data, num);
LPVOID postdata=Cdata;


This seems sloppy to me, but it gives the correct output when I use postdata in the SendRequest function. Thanks for all your help!





-- modified at 15:42 Tuesday 1st August, 2006
GeneralRe: CString to LPVOID Pin
Zac Howland1-Aug-06 8:43
Zac Howland1-Aug-06 8:43 
GeneralRe: CString to LPVOID Pin
EpicYeti1-Aug-06 9:38
EpicYeti1-Aug-06 9:38 
GeneralRe: CString to LPVOID Pin
Zac Howland1-Aug-06 10:02
Zac Howland1-Aug-06 10:02 
GeneralRe: CString to LPVOID Pin
EpicYeti1-Aug-06 10:57
EpicYeti1-Aug-06 10:57 
GeneralRe: CString to LPVOID Pin
Zac Howland1-Aug-06 6:05
Zac Howland1-Aug-06 6:05 
AnswerRe: CString to LPVOID Pin
Zac Howland1-Aug-06 5:51
Zac Howland1-Aug-06 5:51 
AnswerRe: CString to LPVOID Pin
Michael Dunn1-Aug-06 19:37
sitebuilderMichael Dunn1-Aug-06 19:37 
Questioniostream.h in Visual Studio 2005 [modified] Pin
Jay031-Aug-06 5:27
Jay031-Aug-06 5:27 
AnswerRe: iostream.h in Visual Studio 2005 Pin
Zac Howland1-Aug-06 5:52
Zac Howland1-Aug-06 5:52 
AnswerRe: iostream.h in Visual Studio 2005 Pin
Sarath C1-Aug-06 6:59
Sarath C1-Aug-06 6:59 
AnswerRe: iostream.h in Visual Studio 2005 Pin
Michael Dunn1-Aug-06 19:37
sitebuilderMichael Dunn1-Aug-06 19:37 
QuestionDebug runs, Release crashes. Why? Pin
Hotte1-Aug-06 5:14
Hotte1-Aug-06 5:14 
AnswerRe: Debug runs, Release crashes. Why? Pin
toxcct1-Aug-06 5:20
toxcct1-Aug-06 5:20 
QuestionRe: Debug runs, Release crashes. Why? Pin
David Crow1-Aug-06 5:45
David Crow1-Aug-06 5:45 
AnswerRe: Debug runs, Release crashes. Why? Pin
Zac Howland1-Aug-06 5:56
Zac Howland1-Aug-06 5:56 
QuestionSir, Why Virtual Constructor doesn't exist ? Whereas we have virtual Destructor. Pin
CodeVarma1-Aug-06 4:40
CodeVarma1-Aug-06 4:40 
AnswerRe: Sir, Why Virtual Constructor doesn't exist ? Whereas we have virtual Destructor. Pin
toxcct1-Aug-06 4:45
toxcct1-Aug-06 4:45 

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.