How to clear a std::string buff.clear()?
Hi,
I have been trying to clear a buffer which is of type std::string I tried buf.clear(); and buf.erase(); to no avail.... And also can two std::string be concatenated like this buff += tempbuff;? I don't know why the buff is always empty while I read data off the serial port using read API. tempbuff has somethin'! Any comments? Thanks Jack |
> I tried buf.clear(); and buf.erase(); to no avail....
string str = "stuff"; str.clear(); or str.erase(0, str.length()); > And also can two std::string be concatenated like this > buff += tempbuff;? yes http://www.cppreference.com/cppstring/index.html maybe show some code.. (with code tags) |
is it string or std::string ???? :)
Thanks Jack |
it is std::string because it is part of the standard namespace but how it is used is normally personal preference..
you have to say what namespace it is in somehow.. you can either Code:
#include <string> Code:
#include <string> |
All times are GMT -5. The time now is 03:28 PM. |