Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

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 usinga local clone.

dmd.root.file

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

Sourceroot/file.d

Documentationhttps://dlang.org/phobos/dmd_root_file.html

Coveragehttps://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/root/file.d

structBuffer;
Owns a (rmem-managed) buffer.
pure nothrow @nogc @safe ubyte[]extractSlice();
Transfers ownership of the buffer to the caller.
structFile;
structReadResult;
pure nothrow @nogc @safe ubyte[]extractSlice();
Transfers ownership of the buffer to the caller.
pure nothrow @nogc ubyte[]extractDataZ();
dittoInclude the null-terminator at the end of the buffer in the returned array.
static nothrow boolread(const char[]name, ref OutBufferbuffer);
Read the full content of a file, and append it tobuffer
Parameters:
char[]namename of file
OutBufferbufferfile contents appended to it
Returns:
false = success, true = failed
static nothrow boolwrite(const(char)*name, const void[]data);

static nothrow boolwrite(const(char)[]name, const void[]data);
Write a file, returningtrue on success.
static nothrow voidremove(const(char)*name);
Delete a file.
static nothrow boolupdate(const(char)*namez, const void[]data);

static nothrow boolupdate(const(char)[]name, const void[]data);
Update file
If the file exists and is identical to what is to be written, merely update the timestamp on the file. Otherwise, write the file.
The idea is writes are much slower than reads, and build systems often wind up generating identical files.
Parameters:
const(char)[]namename of file to update
void[]dataupdated contents of file
Returns:
true on success
static nothrow ulongsize(const char*namez);
Size of a file in bytes.
Parameters:
char*nameznull-terminated filename
Returns:
ulong.max on any error, the length otherwise.
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 21:23:33 2026

[8]ページ先頭

©2009-2026 Movatter.jp