If i wanted to save entire input till EOF into 1 string, any idea how I would do this?
(besides getline and concating strings every time, thats the only solution I can think of)
Thanks
If i wanted to save entire input till EOF into 1 string, any idea how I would do this?
(besides getline and concating strings every time, thats the only solution I can think of)
Thanks
Given a std::istream named in, one way is:
But I recall from an old thread that a more efficient method works along the lines of what you have described. Perhaps you can search and find out what exactly was the most efficient method we considered.Code:std::stringstream ss; ss << in.rdbuf(); std::string str = ss.str();
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Try to keep things simple. If getline works fine in your situation, leave the alternate. Making things complex for yourself will reap no benefits. Curiosity however is fine and a good thing.