From c7ec29b2d6a66700933ede6ae2371e1d54744d67 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 30 May 2017 19:05:43 +0300 Subject: Add ifdstream::read_text() and ifdstream::read_binary() --- tests/cpfile/driver.cxx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'tests/cpfile/driver.cxx') 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; } -- cgit v1.1