diff options
author | Eugene Sandulenko | 2004-10-16 13:09:52 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-10-16 13:09:52 +0000 |
commit | 54dc902ae4b12a140e450673fb51a42b8ca39b4d (patch) | |
tree | 62795f7ea2d7fdfabdb60f457272ea7dd6f27cd5 /common | |
parent | 6299eaa546b085ebc3e1c21fd6863511507e2984 (diff) | |
download | scummvm-rg350-54dc902ae4b12a140e450673fb51a42b8ca39b4d.tar.gz scummvm-rg350-54dc902ae4b12a140e450673fb51a42b8ca39b4d.tar.bz2 scummvm-rg350-54dc902ae4b12a140e450673fb51a42b8ca39b4d.zip |
Add gets() method to File class.
svn-id: r15572
Diffstat (limited to 'common')
-rw-r--r-- | common/file.cpp | 17 | ||||
-rw-r--r-- | common/file.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/common/file.cpp b/common/file.cpp index 6b7b954942..d2abdf75cc 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -269,3 +269,20 @@ uint32 File::write(const void *ptr, uint32 len) { return len; } + +char *File::gets(void *ptr, uint32 len) { + char *ptr2 = (char *)ptr; + char *res; + + if (_handle == NULL) { + error("File::gets: File is not open!"); + return 0; + } + + if (len == 0) + return 0; + + res = fgets(ptr2, len, _handle); + + return res; +} diff --git a/common/file.h b/common/file.h index 5ee3d80a4a..7a1a35bfea 100644 --- a/common/file.h +++ b/common/file.h @@ -73,6 +73,7 @@ public: virtual void seek(int32 offs, int whence = SEEK_SET); uint32 read(void *ptr, uint32 size); uint32 write(const void *ptr, uint32 size); + char *gets(void *ptr, uint32 size); }; #endif |