Add intfstream_tell

This commit is contained in:
twinaphex 2016-04-07 02:44:21 +02:00
parent 0da67ad4f9
commit a8144abbce
2 changed files with 18 additions and 0 deletions

View File

@ -72,6 +72,8 @@ int intfstream_seek(intfstream_internal_t *intf,
void intfstream_rewind(intfstream_internal_t *intf); void intfstream_rewind(intfstream_internal_t *intf);
size_t intfstream_tell(intfstream_internal_t *intf);
int intfstream_close(intfstream_internal_t *intf); int intfstream_close(intfstream_internal_t *intf);
#endif #endif

View File

@ -222,6 +222,22 @@ int intfstream_getc(intfstream_internal_t *intf)
return 0; return 0;
} }
size_t intfstream_tell(intfstream_internal_t *intf)
{
if (!intf)
return -1;
switch (intf->type)
{
case INTFSTREAM_FILE:
return filestream_tell(intf->file.fp);
case INTFSTREAM_MEMORY:
return memstream_pos(intf->memory.fp);
}
return -1;
}
void intfstream_rewind(intfstream_internal_t *intf) void intfstream_rewind(intfstream_internal_t *intf)
{ {
switch (intf->type) switch (intf->type)