mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
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:
parent
9a2c2170fa
commit
573f49d920
2 changed files with 17 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue