c++builder编写一个聊天程序,运用sendto函数时出现了错误。请大神指教~~
报错:
[C++ Error] Unit1.cpp(46): E2034 Cannot convert 'TWinsock *' to 'unsigned int'
[C++ Error] Unit1.cpp(46): E2342 Type mismatch in parameter 's' (wanted 'unsigned int', got 'TWinsock *')
部分代码如下:
sockaddr_in * RemoteSockAddr;
char*IDBuffer;
Edit_IDAddr->GetSelTextBuf(IDBuffer,100);
RemoteSockAddr->sin_family=AF_INET;
RemoteSockAddr->sin_port=6000;
RemoteSockAddr->sin_addr.S_un.S_addr =inet_addr(IDBuffer);
char*SendBuffer;
Edit_Send->GetSelTextBuf(SendBuffer,100);
sendto(Winsock1,SendBuffer,Edit_IDAddr->GetTextLen()+1 ,0,
(sockaddr*)RemoteSockAddr,sizeof(sockaddr_in));
[解决办法]
Cannot convert 'TWinsock *' to 'unsigned int'
提示的多清楚啊,你查查sendto函数的用法,就明白了
[解决办法]
参数类型不正确