Re: Math Link question about String transfer
- To: mathgroup at smc.vnet.net
- Subject: [mg17540] Re: Math Link question about String transfer
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 14 May 1999 01:13:10 -0400
- Organization: Universitaet Leipzig
- References: <7h5r4m$gvp@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Luc,
use MLGetString() and the code:
MLGetString(stdlink,(const char **) &unistr);
len=strlen(unistr);
endstr=unistr+len;
imagedata=pbm=(char *)calloc(len,sizeof(char));
for(j=i=0,sp=unistr; i<len; i++) {
pbm[j++]= (char) MLNextCharacter((const char **)&sp,(const char
*)endstr);
if(!pbm) break;
}
MLDisownString(stdlink,unistr);
I works fine in the OpenGL Viewer for the bitmap transfer.
Hope that helps
Jens
"Barthelet, Luc" wrote:
>
> How do I declare a function in the .tm file so that mprep will read my
> string argument using MLGetByteString instead of MLGetString? I am
> transfering a bitmap using a string since it is so much faster.
> Maybe MLGetString is ok, but I need to do something to make sure my string
> does not get transformed in a bunch of "/123/432/020...".
>
> Maybe there is another around this altogether. Of course I am trying to
> avoid going Manual, which has been my solution so far.
>
> thanks.
>
> Luc Barthelet
> General Manager
> Maxis
> http://www.simcity.com