inet_ntoa() or not?
printf("Current system IP is: %s", inet_ntoa(*((struct in_addr *)temp)));
I have these lines, and it's basically feeding me with crap IP addresses (one is a 252.x.x.x and another 40.x.x.x) which are both wrong as my IPs are 192.168.x.x and 24.x.x.x (it does the 40.x address second time around in the procedure that I'm calling)
I'm wondering whether I need to do a htons() but am new to network programming and C in general, so wondering if there is anyone that could help me,
Looks like your passing the wrong thing to inet_ntoa().
Remember this post? You should, you started it!! Have a look at the code in there and have another go.
In direct answer though, you need to pass the h_addr element of a struct hostent (I think it's a long). Using a char array as you have done is incorrect. Like I said, look at the code in the other post.