diff options
Diffstat (limited to 'engines/titanic/support')
-rw-r--r-- | engines/titanic/support/simple_file.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/support/simple_file.h | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index f4351f920f..45b5c8a7cb 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -25,6 +25,17 @@ namespace Titanic { +CString readStringFromStream(Common::SeekableReadStream *s) { + CString result; + char c; + while ((c = s->readByte()) != '\0') + result += c; + + return result; +} + +/*------------------------------------------------------------------------*/ + bool File::open(const Common::String &name) { if (!Common::File::open(name)) error("Could not open file - %s", name.c_str()); diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index cf89e5d72c..bca96a631a 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -269,6 +269,11 @@ public: Common::SeekableReadStream *readStream() const { return _inStream; } }; +/** + * General purpose support method for reading an ASCIIZ string from a stream + */ +CString readStringFromStream(Common::SeekableReadStream *s); + } // End of namespace Titanic #endif /* TITANIC_SIMPLE_FILE_H */ |