Skip to content

API to check if file is currently open #442

@keck-in-space

Description

@keck-in-space

I have a need to check if a file is currently open. Is it OK to do so as indicated below?

lfs_file_t* file;
bool isOpen = ((file->flags & LFS_F_OPENED) == LFS_F_OPENED);

This is a useful check to be made in cases where files are written autonomously and could fail to close before the next attempt to open is made.

LFS defines the LFS_F_OPENED flag as internally used, so I wanted to check if this access was safe, or if there are some conditions when the flag isn't immediately updated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions