Windows - ZeroMemory macro

jerro a at a.com
Sat May 26 20:55:56 PDT 2012


On Sunday, 27 May 2012 at 03:29:17 UTC, dnewbie wrote:
> In C I can write
>
> OPENFILENAME ofn;
> ZeroMemory(&ofn, sizeof(ofn));
>
> In D, there is no ZeroMemory. Please help me.

You could use c memset:

import std.c.string;
memset(cast(void*)&ofn, 0, ofn.sizeof);

or this:

(cast(byte*)& a)[0 .. a.sizeof] = 0;


More information about the Digitalmars-d-learn mailing list