casting SysTime to ubyte[]
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 12 06:06:00 PST 2015
On 1/12/15 8:59 AM, Laeeth Isharc wrote:
> import std.datetime;
> import std.stdio;
> import std.conv;
>
> void main(string[] arg)
> {
> auto a=Clock.currTime();
> auto b=cast(ubyte[])a;
> writefln("%s",b);
> }
>
> how do i get the time as a binary representation I can write to a file?
You can always cast one pointer to another without complaint:
(cast(ubyte *)&a)[0..a.sizeof];
-Steve
More information about the Digitalmars-d-learn
mailing list