MCPcopy Create free account
hub / github.com/GJDuck/e9patch / fseek

Function fseek

examples/stdlib.c:3750–3774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3748}
3749
3750static int fseek(FILE *stream, long offset, int whence)
3751{
3752 switch (whence)
3753 {
3754 case SEEK_SET: case SEEK_CUR: case SEEK_END:
3755 break;
3756 default:
3757 errno = EINVAL;
3758 return -1;
3759 }
3760 stdio_lock(stream, -1);
3761 if (fflush_unlocked(stream) < 0)
3762 {
3763 stdio_unlock(stream);
3764 return -1;
3765 }
3766 if (lseek(stream->fd, offset, whence) < 0)
3767 {
3768 stdio_unlock(stream);
3769 return -1;
3770 }
3771 stream->flags &= ~STDIO_FLAG_EOF;
3772 stdio_unlock(stream);
3773 return 0;
3774}
3775
3776static long ftell(FILE *stream)
3777{

Callers 1

test_stdioFunction · 0.85

Calls 2

fflush_unlockedFunction · 0.85
lseekFunction · 0.85

Tested by 1

test_stdioFunction · 0.68