Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/File-size/D/file-size.d
Normal file
22
Task/File-size/D/file-size.d
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import std.file, std.stdio, std.path, std.file, std.stream,
|
||||
std.mmfile;
|
||||
|
||||
void main() {
|
||||
immutable fileName = "file_size.exe";
|
||||
|
||||
try {
|
||||
writefln("File '%s' has size:", fileName);
|
||||
|
||||
writefln("%10d bytes by std.file.getSize (function)",
|
||||
std.file.getSize(fileName));
|
||||
|
||||
writefln("%10d bytes by std.stream (class)",
|
||||
new std.stream.File(fileName).size);
|
||||
|
||||
// mmfile can treat the file as an array in memory.
|
||||
writefln("%10d bytes by std.mmfile (class)",
|
||||
new std.mmfile.MmFile(fileName).length);
|
||||
} catch (Exception e) {
|
||||
e.msg.writefln;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue