added FS_fgets(). From Sander van Dijk.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@541 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-12-24 12:03:29 +00:00
parent 9a2c2170fa
commit 573f49d920
2 changed files with 17 additions and 0 deletions

View file

@ -2084,3 +2084,19 @@ int FS_ferror(fshandle_t *fh)
return ferror(fh->file);
}
char *FS_fgets(char *s, int size, fshandle_t *fh)
{
char *ret;
if (FS_feof(fh))
return NULL;
if (size > (fh->length - fh->pos) + 1)
size = (fh->length - fh->pos) + 1;
ret = fgets(s, size, fh->file);
fh->pos = ftell(fh->file) - fh->start;
return ret;
}

View file

@ -242,6 +242,7 @@ void FS_rewind(fshandle_t *fh);
int FS_feof(fshandle_t *fh);
int FS_ferror(fshandle_t *fh);
int FS_fclose(fshandle_t *fh);
char *FS_fgets(char *s, int size, fshandle_t *fh);
extern struct cvar_s registered;