hi all
i can using the code to see my ip ?
Code:printf("server :'%s'\n",inet_ntoa(server.sin_addr));
but how can i convert the net_ntoa(server.sin_addr) to char inorder to save as string format ?
Printable View
hi all
i can using the code to see my ip ?
Code:printf("server :'%s'\n",inet_ntoa(server.sin_addr));
but how can i convert the net_ntoa(server.sin_addr) to char inorder to save as string format ?
You need to ask a question that makes sense: if you wanted it as a string, you certainly can't convert it to char, since that's not what a string is.
I'm sorry ! String is just explanation .
I want to get the value of inet_ntoa(server.sin_addr) , so i want to save to char .
so how can i conver the value of inet_ntoa(server.sin_addr) to char using C ?
You can't. It's not a char. You can save it to a char array, if you want, using strcpy.