nosehair911@bellsouth.net wrote:
I am trying to send some data out of an outlet using a symbol pointer. I have tried using sprintf like martin suggested with little succes. I am sure I am the one doing something wrong. I am getting a pointer symbol but I am not able to convert the pointer back. In external#1 I have:
The out ---------------- IplImage *frame; char symstr[10]; t_symbol *sym; sprintf(symstr, "%p", frame); sym = gensym(symstr); outlet_symbol(x->m_outFrames, sym);
With this I get an address like: symbol 0x1159da0
...but on the conversion in external#2 I get the problem. The conversion looks like:
The in----------------------- IplImage *in_frame; x->in_frame = (IplImage *)atol(s->s_name); post("frame %s", x->in_frame); post("symbol %s",s->s_name);
...with this I get this: frame (null) symbol 0x1159da0
So I'm getting the symbol in, but its not converting into "in_fame." Does anyone know what I am doing wrong or a way to use Pd's A_POINTER. I have looked at Gem and pdp but I cant figure it out.
Oh yes, atol only converts base 10 but the pointer is in base 16 format. Maybe try: x->in_frame = (IplImage *)sscanf(s->s_name, "%p"); or: x->in_frame = (IplImage *)sscanf(s->s_name, "%x");
OTOH if you did sprintf(symstr, "%lu", frame);
first, then atol would probably work OK.
Martin