diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-29 02:50:12 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-02-29 02:50:12 +0900 |
| commit | 037f1512dbcdf19237d6064660d5c75b4121f0bf (patch) | |
| tree | ec092c918a1396e382d776932d2265b019888b9e /src/BufferedFile.h | |
| parent | c63a524a889415bb321231ac723de8547318900d (diff) | |
Added BufferedFile::getLine() to make reading one line more flexible.
Fixes bug#3495336
Diffstat (limited to 'src/BufferedFile.h')
| -rw-r--r-- | src/BufferedFile.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/BufferedFile.h b/src/BufferedFile.h index db006c8a..421cc8e8 100644 --- a/src/BufferedFile.h +++ b/src/BufferedFile.h @@ -52,8 +52,8 @@ public: BufferedFile(const std::string& filename, const std::string& mode); BufferedFile(FILE* fp); virtual ~BufferedFile(); - // Returns true if file is opened and both ferror and feof returns - // 0. Otherwise returns false. + // Returns true if file is opened and ferror returns 0. Otherwise + // returns false. operator unspecified_bool_type() const; // wrapper for fread. Using 1 for 2nd argument of fread. size_t read(void* ptr, size_t count); @@ -64,6 +64,8 @@ public: char* gets(char* s, int size); // wrapper for fgets, but trailing '\n' is replaced with '\0'. char* getsn(char* s, int size); + // Reads one line and returns it. The last '\n' is removed. + std::string getLine(); // wrapper for fclose int close(); // Return true if open_ && feof(fp_) != 0. Otherwise returns false. |
