MLGetDomainNameList (C 関数)

MLGetDomainNameListWSGetDomainNameListに置き換えられた.

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

マシン上で使用できるドメイン名を含むASCII文字列のリストと,s におけるリストの長さを返す.

詳細

  • MLGetDomainNameList()は,マシン上で使用できるアクティブネットワークインターフェースのそれぞれについて,DNSのドメイン名をロードする.
  • MLGetDomainNameList()は,解放されなければならないドメイン名を保存するためにメモリを割り当てる.MLGetDomainNameList()で割り当てられたメモリを解放するためには,MLGetDomainNameList()によって返されるリスト上でMLReleaseDomainNameList()を呼び出す.
  • MLGetDomainNameList()は,失敗した場合にはNULLを返す.
  • MLGetDomainNameList()は,MathLinkヘッダファイルmathlink.hで宣言される.

例題

  (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);
    }
}