我想设置本地主机的名称。我正在使用 sethostname() 函数,但出现如下错误:
error C3861: 'sethostname': identifier not found.
下面是代码片段:
WSADATA wsa;
///Initialise winsock///
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
{
//Socket Initialization Failed///
exit(EXIT_FAILURE);
}
char setname[128]="Ayesha-PC";
sethostname(setname, sizeof (setname));