一.获取磁盘大小(给入的是文件夹绝对路径):check_disk_available(QString path) { struct statfs diskinfo; unsigned long long size; unsigned long long blocksize; statfs(path.toUtf8().data(),&diskinfo); blocksize=diskinfo.f_bsize; size=diskinfo.f_bavail*blocksize; size=size&g
最近写Qt中的tcp网络编程,Socke连接后,接受到的数据类型是字节型,这就涉及到了大量的类型转换,在网上辗转几辄,总算有了点结果,特此跟大家分享.好了,不废话,下面细说. 方法/步骤 1.打开Qt Creator,我的是2.8.1版本.新建工程,应该包含了基本类型的头文件,这里就不详细说了,因为Qt中的头文件与类名是一样的. 2.首先来两个int类型的数据(或double型): int int_head=5: int int_data=10: 这里的值是随便定的,我的是Socke
QString stores a string of 16-bit QChars, where each QChar corresponds one Unicode 4.0 character. 一.初始化QString字符串 1)Char * 初始化 QString str = "Hello"; QString converts the const char * data into Unicode using the fromAscii() function. 2)QChar[]数组