> means it can only take an actual hardcoded string.
 
if with "hardcoded" you mean a string constant, then the answer is no. "s" is a pointer to any c string, the const part only means that gensym() promises not to modify the string.
google "const correctness".
 
> Can this convert floats to symbols?
 
use a char array together with snprintf, e.g.:
 
char buf[100];
snprintf("foo-%f", sizeof(buf), someFloatValue); // NOTE: you should check the return value, if you want to be safe, see https://linux.die.net/man/3/snprintf
gensym(buf);
 
Christof
 
 
 
Gesendet: Freitag, 22. März 2019 um 17:31 Uhr
Von: "Chuckk Hubbard" <badmuthahubbard@gmail.com>
An: Pd-dev <pd-dev@iem.at>
Betreff: Re: [PD-dev] Converting arbitrary strings to symbol in an external
Thank you.
I have read it.
I understood that the "const" part of "const char *s) means it can only take an actual hardcoded string. Can this convert floats to symbols?
 
On Fri, Mar 22, 2019, 4:19 PM Claude Heiland-Allen <claude@mathr.co.uk> wrote:
Hi Chuckk,

On 22/03/2019 13:59, Chuckk Hubbard wrote:
> Can I convert char[] to symbol?
t_symbol *gensym(const char *s);

recommended reading:
https://github.com/pure-data/externals-howto


Claude
--
https://mathr.co.uk




_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev
_______________________________________________ Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev