Check to see if a file has content inside

Apr 3, 2016 at 2:49am
What would be an easy implementation of reading a file to see if there are contents inside for a beginner?
Apr 3, 2016 at 3:46am
1
2
inline bool has_content( const std::string& path )
{ return std::ifstream(path).peek() != std::ifstream::traits_type::eof() ; }

http://coliru.stacked-crooked.com/a/6906d9b22cc86f5f
Topic archived. No new replies allowed.