[PD-dev] Converting arbitrary strings to symbol in an external

Chuckk Hubbard badmuthahubbard at gmail.com
Fri Mar 22 14:59:50 CET 2019


Hello.
I'm coding externals for the first time.
I want to construct an arbitrary symbol inside my code, to use as an
address for routing other messages that the external sends. For example, if
I have destinations foo-1, foo-2, bar-3, and bar-4 in Pd, I would like to
tell the outlet to convert a string to symbol that would be made from a
constant string ("foo") plus a float (1, 2...), feed that to the right
inlet of a [send] object, and then send the actual message to the other
inlet. I looked at snprintf(), but it writes to a char buffer/pointer, and
none of the functions I can find will accept this in place of symbol. The
number of destinations will be changeable, and I'd prefer not to just
hardcode them all and save them in memory.
Obviously, the [symbol] object outputs a symbol made from user input, but I
haven't located the code where that happens.
Can anyone give me a clue? Can I convert char[] to symbol?

Much appreciated!
-Chuckk


-- 
http://www.badmuthahubbard.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20190322/88a4cad2/attachment.html>


More information about the Pd-dev mailing list