Mathematica > Systems Interfaces & Deployment > C/C++ Language Interface > MathLink C Language Functions >
Mathematica > Systems Interfaces & Deployment > MathLink API > MathLink C Language Functions >
MathLink C Function

MLPutReal32()

int MLPutReal32(MLINK link, double x)
puts the single-precision floating-point number x to the MathLink connection specified by link with a precision corresponding to the C type float.
  • The argument x is typically declared as float in external programs, but must be declared as double in MLPutReal32() itself in order to work even in the absence of C prototypes.
  • MLPutReal32() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutReal32() fails.
  • MLPutReal32() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* send the number 3.4 to a link */

void f(MLINK lp)
{
    float numb = 3.4;

    if(! MLPutReal32(lp, numb))
        { /* unable to send 3.4 to lp */ }
}
© 2008 Wolfram Research, Inc.
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team