On Tuesday, 14 March 2017 at 18:26:52 UTC, flamencofantasy wrote:
import std.mmfile;
auto f1 = new MmFile("file1");
auto f2 = new MmFile("file2");
return f1[] == f2[];
Nice! I don't have experience with memory-mapped files. What are
the pros and cons?
On Tuesday, 14 March 2017 at 08:31:20 UTC, XavierAP wrote:
On Tuesday, 14 March 2017 at 08:12:16 UTC, Andrea Fontana wrote:
First I would check if the files have different size or if
they are the same file (same path, symlink, etc).
Good idea. Good reason to have it in std.file. There might
On Tuesday, 14 March 2017 at 08:12:16 UTC, Andrea Fontana wrote:
First I would check if the files have different size or if they
are the same file (same path, symlink, etc).
Good idea. Good reason to have it in std.file. There might also
be platform dependent shortcuts?
On Monday, 13 March 2017 at 17:47:09 UTC, H. S. Teoh wrote:
bool isEqual(string filename1, string filename2) {
import std.algorithm.comparison : equal;
import std.range : zip;
import std.stdio : File, chunks;
auto f1 = File(
On Monday, 13 March 2017 at 17:47:09 UTC, H. S. Teoh wrote:
Binary comparison is easy. Just read the files by fixed-sized
chunks and compare them.
Follow up question... What is the best @safe way? Since
File.byChunk() is @system. Just out of curiosity, I would rather
use it and flag my code
On Monday, 13 March 2017 at 17:47:09 UTC, H. S. Teoh wrote:
Why it is not easy to do by hand?
Sorry typo, I had intended to type "I know it is easy"
On Mon, Mar 13, 2017 at 10:47:09AM -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> P.S. I just realized that std.stdio.chunks() doesn't return a range.
> Bah. File an enhancement request. I might even submit a PR for it. ;-)
[...]
> P.P.S. It's not overly hard to write an alternative ver
P.P.S. It's not overly hard to write an alternative version of
std.stdio.chunks that returns a real range. Something like this should
do:
// Warning: untested code
auto realChunks(File f, size_t blockSize)
{
static struct Result
{
On Mon, Mar 13, 2017 at 04:50:49PM +, XavierAP via Digitalmars-d-learn
wrote:
> It's not easy to do by hand of course, but I was wondering if there
> was one simple function taking two file names and just returning a
> bool or something like that. I haven't found it in std.file.
Why it is not
It's not easy to do by hand of course, but I was wondering if
there was one simple function taking two file names and just
returning a bool or something like that. I haven't found it in
std.file.
If such a function doesn't exist in Phobos but there's a good
implementation in some other librar
10 matches
Mail list logo