diff options
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 |