OpenersNotesSection(Spacer1)Details

Send the number s in the form "3.14159".

The number s encoded in UTF-16 must begin with a byte order mark.

The length of the string n must include the byte order mark.

MLPutRealNumberAsUTF16String() returns 0 on error, and a nonzero value if the function succeeds.

MLPutRealNumberAsUTF16String() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* A function to put the expression Sqrt[2.75] to a link */

void f(MLINK l)
{
	unsigned short theNumber[5];

	theNumber[0] = 0xFEFF;
	theNumber[1] = '2';
	theNumber[2] = '.';
	theNumber[3] = '7';
	theNumber[4] = '5';

	if(! MLPutFunction(l, "Sqrt", 1))
	{ /* Unable to put Sqrt[] to the link */ }

	if(! MLPutRealNumberAsUTF16String(l, theNumber, 5))
	{ /* Unable to put the number to the link */}

	if(! MLEndPacket(l))
	{ /* Unable to put the end-of-packet sequence to l */ }

	if(! MLFlush(l))
	{ /* Unable to flush any output buffered in l */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLPutRealNumberAsString(), paclet:/ref/c/MLPutRealNumberAsString])  ▪  (NonWLLink[MLPutRealNumberAsUCS2String(), paclet:/ref/c/MLPutRealNumberAsUCS2String])  ▪  (NonWLLink[MLPutRealNumberAsUTF32String(), paclet:/ref/c/MLPutRealNumberAsUTF32String])  ▪  (NonWLLink[MLPutRealNumberAsUTF8String(), paclet:/ref/c/MLPutRealNumberAsUTF8String])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}})}})