Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

lseek SEEK_SET fails on Windows #76

@Y-Less

Description

@Y-Less

No idea why, but the function call returns 0 (which is correct), yet future writes continue from the old location not the new one. I had to change fseek to:

  return fseek((FILE *)params[1],params[2],whence);

And flength to:

  int fn=fileno((FILE*)params[1]);
  c=lseek(fn,0,SEEK_CUR); /* save the current position */
  l=lseek(fn,0,SEEK_END); /* return the file position at its end */
  fseek((FILE *)params[1],c,SEEK_SET);   /* restore the file pointer */

The latter uses a mix of lseek and fseek because all of one or the other failed in different ways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions