MLGetInteger16 (C 函数)

MLGetInteger16 已经被 WSGetInteger16 所取代.

int MLGetInteger16(MLINK link,short *i)

从由 link 指定的 MathLink 连接中获取一个16位整数并以 C short 存在 i 中.

更多信息

  • 如果链接中的数据对应于实数,MLGetInteger16() 会将其四舍五入为整数.
  • 如果链接中数据对应的整数太大,不能存为你的计算机系统的 C short,那么,MLGetInteger16() 将失败并返回0.
  • 获取任意精度整数,可以首先使用 IntegerDigits 获取数字列表,然后调用 MLGetInteger16List().
  • 如果函数成功,MLGetInteger16() 返回非零值.
  • 如果 MLGetInteger16() 失败,则使用 MLError() 检索错误代码.
  • MLGetInteger16() 在 MathLink 的标头文件 mathlink.h 中被声明.

范例

基本范例  (1)

#include "mathlink.h"

/* read a short integer from a link */

void f(MLINK lp)
{
    short s;

    if(! MLGetInteger16(lp, &s))
        { /* unable to read the integer from lp */ }

    /* use the short integer */
}