std library use in C++ external (eg std::string and std::stoull)

Jul 3, 2013 at 5:55pm

std library use in C++ external (eg std::string and std::stoull)

for synchronisation, I need to send an unsigned long long to my external. I currently compile as .cpp (which works fine if you simply cast the object as a (t_object*))
however, although I can get the unsigned lon long into the object (as a message)
I can;t seem to convert it to unsigned long long using std::stoull
and std::string also gives problems
why is that? how could the standard library added/used?
or is tehre a workaround?

void synchroniser_offset(t_synchroniser *x, t_symbol *s, long argc, t_atom *argv)
long i;
t_atom *ap;

post(“message selector is %s”,s->s_name);
//here s->s_name is the value I’m interested in converting to unsigned long long



Jul 3, 2013 at 6:07pm

okay, so I seem to have got somewhere using;


post(“message selector is %s”,s->s_name);
unsigned long long ul = strtoull (s->s_name, NULL, 0);
post(“unsigned %llu “, ul);

perhaps it’s using the C version of the standard library?
being careful to use C-string types, not std::string s?

but the code above works. Any comments appreciated though so I understand why the issue arose.

Jul 3, 2013 at 10:57pm


1. What is the issue ?
2. According to ( ) maybe you could set the base “strtoull(c_string, &NULL, 10);”
3. That’s a C function you can include with cstdlib.
4. From where do you get the t_symbols with unsigned long long ? (The message boxes can manage only the long format).
5. Take care to not flood the symbol table with too many values.


You must be logged in to reply to this topic.