Home > Software engineering >  What a great god help me to look at ~
What a great god help me to look at ~

Time:10-29

This is a program mistake
The error C2664: 'AddString: always convert parameter 1 from' int 'to' const unsigned short * '
Conversion from integral type to pointer type requires reinterpret_cast, C - style cast the or function - style cast
Error executing cl. Exe.
The original code
 DWORD WINAPI CVideoCaptureDemoDlg: : RecvProc (LPVOID lpParameter) 
{
PDlg CVideoCaptureDemoDlg *=(CVideoCaptureDemoDlg *) (: : AfxGetApp () - & gt; GetMainWnd ());
The SOCKET ClientSocket;
ClientSocket=pDlg - & gt; M_socket;
HWND HWND=pDlg - & gt; M_hWnd;
Int retrecv;
Char recvbuf [200].
While (SOCKET_ERROR!=retrecv)
{
Retrecv=recv (ClientSocket, recvbuf, sizeof (recvbuf), 0).
If (SOCKET_ERROR==retrecv)
{
: : SetDlgItemText (HWND IDC_EDIT_STATE, _T (" lianjie duankai "));
break;
}
Else if (retrecv!=0)
{
PDlg (const unsigned short *);
PDlg - & gt; M_ListRecv. AddString (retrecv);


PDlg - & gt; M_ListRecv. SetHorizontalExtent (10000);
}
}
wrong is wrong here pDlg - & gt; M_ListRecv. AddString (retrecv); How to change? I unicode compiled useful way

CodePudding user response:

PDlg - & gt; M_ListRecv. AddString (retrecv);
Here is your retrecv int type, not TCHAR */cstrings type,

CodePudding user response:

Cstrings STR.
STR. The Format (" % d ", retrecv);
PDlg - & gt; M_ListRecv. AddString (STR);

CodePudding user response:

Cstrings STR.
STR. The Format (" % d ", L retrecv);
PDlg - & gt; M_ListRecv. AddString (STR);
  • Related