diff --git a/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc b/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc index c0b6999f9f..97ef289fbd 100644 --- a/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc +++ b/fastlib/branches/fastlib-stl/fastlib/file/textfile.cc @@ -108,6 +108,7 @@ void TextLineReader::Error(const char *format, ...) { success_t TextLineReader::Open(const char *fname) { f_ = fopen(fname, "r"); + fname_ = strncpy(new char[strlen(fname) + 1], fname, strlen(fname) + 1); line_num_ = 0; has_line_ = false; fname_ = fname; diff --git a/fastlib/branches/fastlib-stl/fastlib/file/textfile.h b/fastlib/branches/fastlib-stl/fastlib/file/textfile.h index 1d6bba6837..6e1605ab91 100644 --- a/fastlib/branches/fastlib-stl/fastlib/file/textfile.h +++ b/fastlib/branches/fastlib-stl/fastlib/file/textfile.h @@ -46,14 +46,10 @@ #include "../base/base.h" -#include #include #include #include -#include -#include - /** * Helper for reading text files. * @@ -100,15 +96,15 @@ class TextLineReader { (void)fclose(f_); f_ = NULL; } - - /** + + /** * Return the name of the file we are working with. * This will return NULL if no file has been opened yet. */ const char *filename() const { - return fname_.c_str(); + return fname_; } - + /** * Are there more lines left? */ @@ -251,7 +247,6 @@ class TextTokenizer { } } - /* bool MatchNoCase(const char *str) { if (next_.EqualsNoCase(str)) { Gobble(); @@ -260,7 +255,6 @@ class TextTokenizer { return false; } } - */ bool MatchInteger() { return MatchType(INTEGER);