-
"datastream" class
This isn't too useful (and there might be a standard STL that does this anyway), but this might make coding more convenient.
When you pass this object data, it uses sprintf to convert it to a string.
Code:
datastream x;
x << 5;
int y;
x >> y;
That basically would assign y the value of 5.
You can use the indexing operators, cout it, cin to it... ifstream, ofstream...
Enjoy! Its not very complex, but it could be useful (if there is a built in one, please tell me so I can look it up)
-
There is a built-in object that is called std::stringstream in the <sstream> header.
It reads and writes data to and from a string.
-
how do you use it, and does it let you search using the indexing op?
datastream x = 12345;
x[x["23"]] will work, as long as 23 is found