开发者

what's the type of 'struct random_data* buf'? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜