dmd.root.file - D Programming Language
Description: D Programming Language
Keywords: D programming language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# dmd.root.file

Read a file from disk and store it in memory.
Authors:
Walter Bright, http://www.digitalmars.com
License:
Boost License 1.0

Source root/file.d

Documentation https://dlang.org/phobos/dmd_root_file.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/root/file.d

struct `FileBuffer`;
  Owns a (rmem-managed) file buffer.
  pure nothrow @nogc @safe ubyte[] `extractSlice`();
    Transfers ownership of the buffer to the caller.
struct `File`;
  struct `ReadResult`;
    pure nothrow @nogc @safe ubyte[] `extractSlice`();
      Transfers ownership of the buffer to the caller.
    pure nothrow @nogc ubyte[] `extractDataZ`();
      ditto Include the null-terminator at the end of the buffer in the returned array.
  static nothrow ReadResult `read`(const(char)* `name`);
  static nothrow ReadResult `read`(const(char)[] `name`);
    Read the full content of a file.
  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.
  static nothrow void `remove`(const(char)* `name`);
    Delete a file.

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Sat Aug 15 10:00:52 2020