Skip to content

[DOC] ff_truncate documentation inadequate #54

Closed
@carlk3

Description

@carlk3

Describe the issue
Please describe the issue and expected clarification in concise language.

ff_truncate has important restrictions that are not mentioned. Since this behavior is non-standard, I believe it would be best to state the restrictions rather than leave them unsaid. They might come as a surprise to someone used to, say, POSIX.

ff_truncate says that it " Opens a file for writing...", but technically, that is not true. It actually opens a file for append, as in ff_fopen pcMode "a" or "a+". Therefore, because of the limitations of fseek and ff_rewind, if the file already exists and it is opened with ff_truncate it is impossible to move the file position to the absolute beginning of the file or to any position between there and the end of the preexisting file.

Also, it's non-standard that ff_truncate returns a pointer to an opened file. See truncate or File Size.

Reference
Please attach the URL at which you are experiencing the issue.

https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_FAT/stdio_API/ff_truncate.html

Screenshot
If applicable, please attach screenshot.

Browser

  • Browser: [e.g. Chrome]
  • Version: [e.g. 80.0.3987.132]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions