Forums > Dev

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

July 3, 2013 | 5:55 pm

Hi,
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

}

Thanks!


July 3, 2013 | 6:07 pm

okay, so I seem to have got somewhere using;
#include

and

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.


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