what's the type of 'struct random_data* buf'?

1.5k Views Asked by At

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

1

There are 1 best solutions below

2
On

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).