Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 2008 09:02:03 +0200 (CEST)
From:      Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
To:        Robert Huff <roberthuff@rcn.com>
Cc:        questions@freebsd.org
Subject:   Re: using /dev/random
Message-ID:  <20080923090135.B35746@wojtek.tensor.gdynia.pl>
In-Reply-To: <18648.30321.369520.631459@jerusalem.litteratus.org>
References:  <18648.30321.369520.631459@jerusalem.litteratus.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>
> 	What is the canonical way to get data from /dev/random?
> Specifically: having opened the file, how do I read the stream?
> I'm currently using
>
>
>  union {
>    float f;
>    char c[4];
>  } foo;
>
>  foo.f = 0.0;
>
>  fscanf(rand_fp,"%4c",foo.c);
>
simply read 4 bytes into foo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080923090135.B35746>