Changeset 1437 for trunk/gsdl/lib


Ignore:
Timestamp:
2000-08-21T16:47:48+12:00 (24 years ago)
Author:
sjboddie
Message:

* empty log message *

Location:
trunk/gsdl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/fileutil.cpp

    r1434 r1437  
    253253#endif
    254254}
     255
     256// returns the last line (or last 256 characters)
     257// of filename file
     258text_t file_tail (const text_t &filename) {
     259
     260  text_t return_str;
     261  char *filenamec = filename.getcstr();
     262
     263  ifstream file_in (filenamec);
     264  if (file_in) {
     265    file_in.seekg (256, ios::end);
     266    char c;
     267    file_in.get(c);
     268    while (!file_in.eof()) {
     269      if (c == '\n') return_str.clear();
     270      else return_str.push_back (c);
     271      file_in.get(c);
     272    }
     273    file_in.close();
     274  }
     275  delete filenamec;
     276  return return_str;
     277}
  • trunk/gsdl/lib/fileutil.h

    r1426 r1437  
    5151void file_copy (const text_t &fromfile, const text_t &tofile);
    5252
     53text_t file_tail (const text_t &filename);
     54
    5355#endif
Note: See TracChangeset for help on using the changeset viewer.