From 54dc902ae4b12a140e450673fb51a42b8ca39b4d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 16 Oct 2004 13:09:52 +0000 Subject: Add gets() method to File class. svn-id: r15572 --- common/file.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'common/file.cpp') 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; +} -- cgit v1.2.3