Forums > Dev

Symbol consisting of number

September 11, 2013 | 8:06 am

Hi all,

I use the following code to generate a message in the C SDK:

t_atom msg[1];
atom_setsym(msg, atom_getsym(argv+1));

long k = 2;
char buffer[255];
sprintf(buffer, "%ld", k);
outlet_anything(x->m_outlet1, gensym(buffer), 1, msg);

The generated message looks like this:
"2" test

What can I do to avoid the quotes? I would like to use the message in a [route 1 2 3 4] style. It seems possible to have messages starting with numbers without quotes:
<code>

– Pasted Max Patch, click to expand. –

</code>

Am I missing something here?
Thanks for any help!
Best, Boris


September 12, 2013 | 1:51 am

Works like a charm :)
Thanks Nicolas!


September 13, 2013 | 6:05 am

The alternative would be to pass the symbolized number through a [fromsymbol] object in your patch. But Nicolas’ approach (which I would also recommend) is much more to the point. Why turn a number into a symbol if what you want is the number, right?-)


Viewing 3 posts - 1 through 3 (of 3 total)