when i issue a gethostname() call it does not return my hostname. Instead it returns "zstation" which is the computers name in the network neighbourhood. It does not resolve either. what do i do now? i need to find the IP of the interface connected to internet somehow. be it dialup or ethernet.
In these situations I always think 'what would I call it?' to myself and type that into the MSDN site..... and sure enough:- GetComputerName is what you want, it takes two parameters an address of a buffer, and the length of that buffer. it's in Kernel32.inc umbongo
but i don't want my computer name, i want my hostname, h142n1fls2o801.telia.com, so that i can get my current IP (as seen in winipcfg) :) This message was edited by Zynaps, on 3/7/2001 9:01:06 AM
Hmmm.. when I use gethostbyname it gives me my computer name and I can use that to get my IP address. GetComputerName does the same thing, and I can use that to get my IP address. So it's the same thing isn't it? Give it a try, it should work :-) umbongo p.s. I got the Parameters wrong, the second parameter is the address of the length, before the call, and after the call it changes the length to that of the returned string.
Nothing was wrong, i mis-read something in thi API reference :/