Skip to content
FutureBlitz

    Install

    Import std.io.file_stream

    OpenOptions

    std.io.file_stream

    struct

    Public Struct OpenOptions

    How File.Open opens a file: to read, to write, or both, and, for one it writes, whether each write goes at its end, whether it's made when it isn't there, or only then, and whether what it held is gone first.

    Examples

    Local file = Try TempFile()
    Try File.WriteText(file.Path, "start")
    Local options = OpenOptions()
    options.Write = True
    options.Append = True
    Local stream = Try File.Open(file.Path, options)
    Try stream.WriteText(", then more")
    stream.Close()
    Expect((Try File.ReadText(file.Path)) == "start, then more")
    Try file.Close()

    std/io/file_stream.fb, line 53

    • Public Field Read: Bool field #

      Whether it reads the file.

    • Public Field Write: Bool field #

      Whether it writes the file.

    • Public Field Append: Bool field #

      Each write goes at the file's end, wherever the stream is, which is a write too.

    • Public Field Create: Bool field #

      The file is made, empty, when it isn't there.

    • Public Field CreateNew: Bool field #

      The file is made, and one that's there is an IOError of ALREADY_EXISTS.

    • Public Field Truncate: Bool field #

      What the file held is gone once it's open.

    Report an issue with this page or with FutureBlitz on GitHub.