15 Sep
2009
15 Sep
'09
5:40 p.m.
pedro chaparro wrote:
in the ouput i have this : 5050??
the first "50" i write with std::cout.write(buf.data(),len);
and the second "50" plus those stange characters
std::string datos=buf.data(); printf("%s \n",datos);
i suppose that those characters means that are not null terminated. right? So how can i only take the "50" without the other characters?
thanks
std::string does not work well with varargs, use std::string::c_str member function to convert it to a null-terminated string: printf("%s \n",datos.c_str()); Regards, Anders Dalvander