0
string s = "100:T1:R1:170.168.0.9:55555:11111";
stringstream ss;
ss<<s;
string Temp= ss.str();
ss.str(string());
char *buff= const_cast<char *>(Temp.c_str());
I have string in this buff.
int len;
len=sendto(sd, buff,sizeof(buff), 0, (struct sockaddr*)&addr, sizeof(addr));
cout<<"\n"<<len<<endl;
當我寫這段代碼時,我得到的長度是8,即我想發送的字符串的8個字符,但是我想發送整個字符串。 所以,請幫助我。發送到函數錯誤: