dmd.root.file

Read a file from disk and store it in memory.

Authors

Walter Bright, http://www.digitalmars.com

Source: root/file.d

  • Declaration

    struct FileBuffer;

    Owns a (rmem-managed) file buffer.

    • Declaration

      pure nothrow @nogc @safe ubyte[] extractSlice();

      Transfers ownership of the buffer to the caller.

  • Declaration

    struct File;

    • Declaration

      struct ReadResult;

      • Declaration

        pure nothrow @nogc @safe ubyte[] extractSlice();

        Transfers ownership of the buffer to the caller.

      • Declaration

        pure nothrow @nogc ubyte[] extractDataZ();

        ditto Include the null-terminator at the end of the buffer in the returned array.

    • Declaration

      static nothrow ReadResult read(const(char)* name);
      static nothrow ReadResult read(const(char)[] name);

      Read the full content of a file.

    • Declaration

      static nothrow bool write(const(char)* name, const void[] data);
      static nothrow bool write(const(char)[] name, const void[] data);
      static nothrow bool write(const(char)* name, const(void)* data, size_t size);

      Write a file, returning true on success.

    • Declaration

      static nothrow void remove(const(char)* name);

      Delete a file.