I hate to send this as I have seen so many postings on this subject, but I can not seem to make this work.
Ok, so I have a simple socket app that is barking at my send command
Here is the code that I used:Code:error C2664: 'strlen' : cannot convert parameter 1 from 'class CString' to 'const char *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called C:\TRANSFERLAP\MEATPLANT\Mobile\MobileDlg.cpp(187) : error C2664: 'send' : cannot convert parameter 2 from 'class CString' to 'const char *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
the funny thing is this actually works in regular windows, its my embedded c++ windows ce compiler where I get this error. I don't of any forums for CE but everyone here is always very help, can anyone help explain how I might convert my CString variable to a const char that might be excepted by my send () command?Code:#include <stdio.h> #include <winsock.h> #include <windows.h> #include "string" #include "cstring" using namespace std; { CString m_BarCode; m_BarCode +=STR; m_BarCode +=CD128; m_BarCode +=m_Barcode; m_BarCode +=CR; //accept() will accept an incoming //client connection client=accept(server, (struct sockaddr*)&from,&fromlen); //send this string to the client send(client,m_BarCode,strlen(m_BarCode),0); //close the client socket and clear variable data for next pass, wait a few //seconds to ensure the network transfer of info was complete. Sleep (3000); m_BarCode =""; m_Barcode =""; UpdateData (false); closesocket(client); closesocket(server); break; }



LinkBack URL
About LinkBacks



