java的
é£ä¸ªä¸æ¯ç©ºæ ¼ï¼ä½ ç¨æµæ¥æ¶çæ¶å没æ¥æ¶å
¨æåéçæ¶å没æ以\0ç»å°¾ï¼æ²¡æ转æç¸åºçå符串追é®
请é®ææ ·è§£å³
追çå¦æä½ æ¯ç¨çC/C++ï¼å¨èªå®ä¹åè®®éé¢å®ä¹ä¸ä¸é¿åº¦ï¼å®¢æ·ç«¯æ¥æ¶å°char buff[]ä¹åï¼è¯»åç¸åºçé¿åº¦ï¼ææåä¸ä¸ªchar 设置为\0å³å¯ï¼æ¯å¦
char buff[20];
int len = recv(fd, buff, 20, 0)
buff[len-1] = '\0';
温馨提示:答案为网友推荐,仅供参考