gethostname(text,200); // get IP of local host
t2=gethostbyname(text) ; // and show it in the title of the application
if ( t2!=NULL )
{
memmove(&ip2,*t2->h_addr_list,sizeof(PCHAR));
memmove(&pc.sin_addr.s_addr,&ip2,sizeof(PCHAR));
sprintf(text,"ip=%s",inet_ntoa(pc.sin_addr));
SetWindowText(hwnd_all,text);
}
[Win32] а как через API?06.11.02 04:34 Автор: vh <Дмитрий> Статус: Member
> а как это сделать используя функции API? > я помню у меня было где-то на компе (там какая то одна > функция)...но к сожалению не могу теперь найти :( gethostbyname
The Windows Sockets gethostbyname function retrieves host information corresponding to a host name from a host database.
struct hostent FAR * gethostbyname(
const char FAR *name
);
Parameters
name
[out] A pointer to the null-terminated name of the host to resolve.
Return Values
If no error occurs, gethostbyname returns a pointer to the HOSTENT structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.
gethostbyname на XP нихера не пашет!!! (на всех остальных ОС работает нормально)11.12.02 05:22 Автор: white Статус: Незарегистрированный пользователь
> > а как это сделать используя функции API? > > я помню у меня было где-то на компе (там какая то одна > > функция)...но к сожалению не могу теперь найти :( > gethostbyname