diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-30 19:05:43 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-31 00:51:43 +0300 |
commit | c7ec29b2d6a66700933ede6ae2371e1d54744d67 (patch) | |
tree | 119ff80f333892422e99cd352c99702f0ae7eb7c /tests/cpfile/driver.cxx | |
parent | 95ff8f359cfc2189bd4d7e02e15373027d2bda32 (diff) |
Add ifdstream::read_text() and ifdstream::read_binary()
Diffstat (limited to 'tests/cpfile/driver.cxx')
-rw-r--r-- | tests/cpfile/driver.cxx | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/tests/cpfile/driver.cxx b/tests/cpfile/driver.cxx index 6fa1567..3a19322 100644 --- a/tests/cpfile/driver.cxx +++ b/tests/cpfile/driver.cxx @@ -22,14 +22,7 @@ static string from_file (const path& f) { ifdstream ifs (f, ios::binary); - string s; - - // Note that the eof check is important: if the stream is at eof (empty - // file) then getline() will fail. - // - if (ifs.peek () != ifdstream::traits_type::eof ()) - getline (ifs, s, '\0'); - + string s (ifs.read_text ()); ifs.close (); // Not to miss failed close of the underlying file descriptor. return s; } |