[PD] atom_getsymbol

IOhannes m zmölnig zmoelnig at iem.at
Mon Jan 9 20:34:59 CET 2017

On 01/09/2017 06:59 PM, Ricky Graham wrote:
> Hi all,
> I’d like to use atom_getsymbol to get some text from an object on creation. 

atom_getsymbol() is used to get a t_symbol* from a t_atom*.

> I’m using A_DEFSYMBOL 

when using A_DEFSYMBOL, you don't deal with t_atom*s; instead you get a
t_symbol* directly.
so there is no use for atom_getsymbol()

> for the moment and *s seems to print to console


> but I can’t seem to figure out how to get type t_symbol into an array.

into an array of what?
this doesn't make sense (and i suspect that this is why it doesn't work
for you)

> atom_string seems to work with A_GIMME but that seems redundant as I’m only passing one symbol.

a symbol is a pointer to a "t_symbol" struct.
the t_symbol struct has a member "s_name" which is a pointer to a
zero-terminated immubtale string.
most likely this is what you want.

since symbols are statically allocated, this pointer will remain valid
through the process's lifetime.
so most likely, you don't want to "copy it to an array", but rather keep
the pointer around and use it directly.
there's only one exception to this: if you want to modify the string,
then you *must* copy it first.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20170109/7cd59d03/attachment.sig>

More information about the Pd-list mailing list