MLGetData (C 函数)
MLGetData 已经被 WSGetData 所取代.
int MLGetData(MLINK link,char *b,int len,int *count)
从由 link 指定的 MathLink 连接中获取文本数据,把结果存在最大长度为 len 的缓冲区 b 中,并把实际读取的字节数存在 count 中.
更多信息

- MLGetData() 不分配
;必须提供
.
- MLGetData() 在错误事件中返回0,如果函数成功则返回非零值.
- 如果 MLGetData() 失败,则使用 MLError() 检索错误代码.
- MLGetData() 在 MathLink 的标头文件 mathlink.h 中被声明.
范例
基本范例 (1)
#include "mathlink.h"
/* read data from a link in textual form */
void f(MLINK lp)
{
int size, count;
char *buff;
switch(MLGetType(lp))
{
case MLTKSTR:
if(! MLBytesToGet(lp, &size))
{
/* unable to read the number of bytes from lp */
return;
}
buff = (char *)malloc(size * sizeof(char));
if(buff == (char *)0)
{
/* unable to allocate mmemory */
return;
}
if(! MLGetData(lp, buff, size &count))
{
/* unable to read the string data from lp */
free(buff);
return;
}
/* ... */
free(buff);
break;
}
/* ... */
}