07-27-2023, 11:27 AM
I write a server using the function `char* inet_ntoa(struct in_addr in),` When I included the header
`<sys/socket.h>` and `<netinet/in.h>` ,an executable binary can be generated with compiler warnings, but a segment fault happens, when the program handle the return string from `inet_ntoa`. But when I added the header `<arpa/inet.h>,` everything seems ok.
What's the matter?
`<sys/socket.h>` and `<netinet/in.h>` ,an executable binary can be generated with compiler warnings, but a segment fault happens, when the program handle the return string from `inet_ntoa`. But when I added the header `<arpa/inet.h>,` everything seems ok.
What's the matter?