casting SysTime to ubyte[]
Daniel Kozák via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 12 06:11:28 PST 2015
V Mon, 12 Jan 2015 13:59:27 +0000
Laeeth Isharc via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> napsáno:
> 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?
>
> Thanks.
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b= (cast(ubyte*)&a)[0 .. a.sizeof];
writefln("%s",b);
}
More information about the Digitalmars-d-learn
mailing list