Reading a specific number of characters from C++ stream into std::string
问题 I'm pretty familiar with most of C++ but one area I've avoided has been IO streams, mainly because I've been using it on embedded systems where they're not appropriate. Recently I've had to become familiar with them, however, and I'm struggling to figure out something that I feel should be simple. What I'm looking for a relatively efficient way to read a fixed number of characters from a C++ stream into a std::string . I could easily read into a temporary char array with the read() method and