- 博客(7)
- 收藏
- 关注
原创 Linux C/C++实现随机数
#include <stdlib.h>#include <time.h>#include <stdio.h>int main(){ //随机种子 srand((unsigned int)time(NULL)); for(int i = 0;i < 10 ;i ++) { //printf("%d ",rand()%101);//生成0~100之间 printf("%d ",rand()%101 - 50);//生成-50~50之间 }
2021-10-24 11:18:49
3882
原创 虚拟机映射、虚拟机与物理机共享文件夹
1.安装Samba软件包 sudo apt-get install samba2.更改Samba配置文件//建议备份sudo vi /etc/samba/smb.conf3.在smb.conf末尾添加[share] comment = VMware Ubuntu Share path = / writable = yes browseable = yes create mask = 0777目录可以自定义4.创建共享用户sudo smbpasswd -a 用户名(
2021-10-24 06:00:00
723
原创 C/C++字符串及其QString之间的转换
QString str = QString("trans %1").arg("test"); qDebug() << str; //QString 转 const char* 可以去掉QString中的双引号 const char* Cstr = str.toUtf8().data(); printf("%s\n",Cstr); //QString 转 string std::string CPPstr= str.toStdString();
2021-10-17 12:12:44
835
原创 Qt获取当前系统时间和时间戳及其之间转换
#include <QCoreApplication>#include <QDateTime>#include <QDebug>#include <QDate>int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); //获取当前系统时间 QDateTime TodayTime = QDateTime::currentDateTime(); qD
2021-10-16 21:02:07
4294
原创 Linux c/c++ 遍历指定目录下的文件
struct dirent{long d_ino; /* inode number 索引节点号 /off_t d_off; / offset to this dirent 在目录文件中的偏移 /unsigned short d_reclen; / length of this d_name 文件名长 /unsigned char d_type; / the type of d_name 文件类型 /char d_name [NAME_MAX+1]; / file n
2021-08-29 13:26:27
875
原创 Linux C/C++ 读写文件
#include <iostream>#include <string>#include <string.h>#include <cstdlib>#include <fstream>#include <streambuf>#include <sstream>using namespace std;string C_Read_And_Write_File(const char* FileName,cons
2021-08-22 13:33:18
1003
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人