Qt and C and C++ 使用 /dev/random or /dev/urandom产生随机数

来源:互联网 发布:ubuntu 装mysql数据库 编辑:程序博客网 时间:2024/06/11 03:03
#include <QString>#include <QDebug>using namespace std;int main(){int byte_count = 16;char data[16];FILE *fp;fp = fopen("/dev/random", "r");fread(&data, 1, byte_count, fp);QString qstr(data);qDebug() << QString(qstr.toAscii().toHex());}
这直接贴代码了 没有整理 头文件也是全部一股脑的加上的 有需要的可以拿去 0.0 
刚试了 ,所有的头文件都可以不要0.0


原创粉丝点击