what's the type of 'struct random_data* buf'? [closed]
I'd like to have an instance variable of "struct random_data*" which are used in
int random_r(struct random_data *buf, int32_t *result);
I've tried declaring as
"struct random_data* instanceBuf;"
"random_data* instanceBuf;"
but compiler doesn't like any of it.
How should I declare the variable?-开发者_如何学运维Edit
ah,, the api is for linux, and i'm on mac(bsd) :(
Oh wait, is it really linux only? http://www.gnu.org/s/libc/manual/html_node/BSD-Random.html
Probably:
struct random_data buff;
int x = random_r (&buff, ...);
is the easiest solution. But you'll have to make sure that that structure has been defined.
And, if the buffer is required to be long lived (like a seed), make sure it's defined somewhere with a large scope (global or class-level, for example).
精彩评论