Add memstream_rewind

This commit is contained in:
twinaphex 2016-04-07 02:24:31 +02:00
parent f51e0f62e5
commit ea037799a4
2 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,8 @@ char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
size_t memstream_pos(memstream_t *stream);
void memstream_rewind(memstream_t *stream);
int memstream_seek(memstream_t *stream, int offset, int whence);
void memstream_set_buffer(uint8_t *buffer, size_t size);

View File

@ -142,6 +142,11 @@ int memstream_seek(memstream_t *stream, int offset, int whence)
return -1;
}
void memstream_rewind(memstream_t *stream)
{
memstream_seek(stream, 0L, SEEK_SET);
}
size_t memstream_pos(memstream_t *stream)
{
return stream->ptr;