我有一个字符串说
char resp_buf[20000];
sprintf(resp_buf,"HTTP/1.0 404 File not Found.\r\nContent-Type: text/html\r\\
n\r\n<html><body><h2>Error 404: The file your have requested does not exist.</h2\
></body></html>");
因此,在此之后,当我稍后调用发送时-->
send(fd,resp_buf,strlen(a),0);
数据确实被发送,但服务器崩溃并给出分段错误。
我怎样才能找到它的字节大小,以便我可以在 send() 中使用它进行套接字编程。我收到一大堆分割错误。我已经尝试过 strlen(a) 和 sizeof(a),但两者都给出了
分段错误(核心转储)