I need to get the IP address of the System in C or C++
Printable View
I need to get the IP address of the System in C or C++
128.0.0.1
What the answer is yours... ???
I want a C code which gives the Ip address of a system!
there is a dedicated address for local hosts and it's 127.0.0.1 not 128.0.0.1 as i've seen in the first reply. it's usualy used for tests. if you are looking for something about your computer not a simply IPaddress use 'getenv(<arg>)' where <arg> could be 'REMOTE_ADDR' (for your question) or some other enviroment variable. to find all specific enviroment variable for your computer just travers '_environ' which has 'char**' type.
use 'char** myEnv = _environ; while(*myEnv){ ...myEnv++} ' etc. ...
I think he was referring to a perl CGI script.
Anarchos