MLPutInteger16()

MLPutInteger16 has been replaced by WSPutInteger16.

int MLPutInteger16(MLINK link,int i)

puts the 16-bit integer i to the MathLink connection specified by link.

Details

  • The argument i is typically declared as short in external programs, but must be declared as int in MLPutInteger16() itself in order to work even in the absence of C prototypes.
  • MLPutInteger16() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutInteger16() fails.
  • MLPutInteger16() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* send the expression Times[10,30] to a link */

void f(MLINK lp)
{
    short a = 10;
    short b = 30;

    if(! MLPutFunction(lp, "Times", 2))
        { /* unable to put the function to lp */ }

    if(! MLPutInteger16(lp, a))
        { /* unable to put the integer to lp */ }

    if(! MLPutInteger16(lp, b))
        { /* unable to put the integer to lp */ }

    if(! MLEndPacket(lp))
        { /* unable to send the end-of-packet indicator to lp */ }

    if(! MLFlush(lp))
        { /* unable to flush outgoing data to lp */ }
}

See Also

MLPutInteger32()  MLPutInteger64()

Tutorials