Feb. 29th, 2008

zwol: ((mad) science)

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?

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 3rd, 2026 11:33 pm
Powered by Dreamwidth Studios