| zwol ( @ 2008-02-29 03:19:00 |
irritating corner-case c++ question
Is there any portable way to read [as in the system call] from a file directly into a C++ standard string? One would like to do something like
str.reserve(filesize); got = ::read(fd, str.data(), str.capacity()); str.enlarge_to_cover(got);
(error handling and loop until EOF omitted for clarity) but I can't actually find a method that does enlarge_to_cover(). Also, data() returns a read-only pointer.
... why am I still awake?