MLGetInteger8 (C 函数)

MLGetInteger8 已经被 WSGetInteger8 所取代.

int WLGetInteger8( MLINK l , unsigned char * i )

gets an 8-bit integer from the MathLink connection specified by l and stores it in i.

更多信息

  • If the data on the link corresponds to a real number, MLGetInteger8() will round it to an integer.
  • If the data on the link corresponds to an integer too large to store in a C unsigned char on your computer system, then MLGetInteger8() will fail, and return 0.
  • You can get arbitrary-precision integers by first using IntegerDigits to generate lists of digits, and then calling MLGetInteger8List().
  • MLGetInteger8() returns a nonzero function value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetInteger8() fails.
  • MLGetInteger8() is declared in the MathLink header file mathlink.h.

范例

基本范例  (1)

#include "mathlink.h"

/* A function to read an unsigned char from a link */

void f(MLINK l)
{
    unsigned char c;

    if(! MLGetInteger8(l, &c))
    { /* Unable to read the integer from l */ }

    /* Use the integer */
}