P
pmatos
Hi all,
I have 2 char* iterators str and end and I'm doing as follows:
string id_str(str, end);
const char * id = id_str.c_str();
but these has 2 problems afaik. One, I'm generating a string as an
intermediate step to get a char*, which seems useless. Two, I don't
know when id gets destroyed or when the chars to where id points to are
cleaned. I could now use strcopy to copy id to a freshly allocated
string but... is there any more direct way? (more efficient perhaps???)
Cheers,
Paulo Matos
I have 2 char* iterators str and end and I'm doing as follows:
string id_str(str, end);
const char * id = id_str.c_str();
but these has 2 problems afaik. One, I'm generating a string as an
intermediate step to get a char*, which seems useless. Two, I don't
know when id gets destroyed or when the chars to where id points to are
cleaned. I could now use strcopy to copy id to a freshly allocated
string but... is there any more direct way? (more efficient perhaps???)
Cheers,
Paulo Matos