How to use /dev/random or urandom in C?

前端 未结 5 1985
面向向阳花
面向向阳花 2020-11-28 02:37

I want to use /dev/random or /dev/urandom in C. How can I do it? I don\'t know how can I handle them in C, if someone knows please tell me how. Tha

5条回答
  •  一向
    一向 (楼主)
    2020-11-28 02:56

    Just open the file for reading and then read data. In C++11 you may wish to use std::random_device which provides cross-platform access to such devices.

提交回复
热议问题