c++ - Transfer specified number of bytes from one stringstream to another -


given

  • a size_t n (typically valued in millions)
  • a stringstream a, containing many more n bytes
  • a pre-existing empty stringstream b

what might way transfer n bytes a b?

i think following work

std::string s; s.resize(n); a.read(&s[0], n); b << s.rdbuf(); 

but isn't there way skip intermediate string s , transfer n bytes directly a b?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -