MLGetDomainNameList (C 函数)

MLGetDomainNameList 已经被 WSGetDomainNameList 所取代.

char ** MLGetDomainNameList(MLENV env,unsigned long *s)

返回包含机器上可用域名的 ASCII 字符串列表,和 s 中列表的长度.

更多信息

  • MLGetDomainNameList() 为每个机器上可用的有源网络界面加载 DNS 域名.
  • MLGetDomainNameList() 分配内存来存储必须释放的域名. 若要释放由 MLGetDomainNameList() 分配的内存,则调用由 MLGetDomainNameList() 返回的列表中的 MLReleaseDomainNameList().
  • 失败时,MLGetDomainNameList() 返回 NULL.
  • 在 MathLink 标头文件 mathlink.h 中声明 MLGetDomainNameList()

范例

基本范例  (1)

#include "mathlink.h"

/* A function that reads the domain names available on a machine */

void f(MLENV env)
{
    char **theList = NULL;
    char *tmp;
    unsigned long length;

    theList = MLGetDomainNameList(env, &length);

    if(length > 0 && theList != (char **)0)
    {
        while((tmp = *theList++) != (char *)0)
        {
            /* ... */
        }

        MLReleaseDomainNameList(env, theList, length);
    }
}