易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下计算指定目录下影件的大小,基于c语言

 1//由于使用gcc编译,所以编译时要链接上c++的库,命令是gcc -lstdc++ main.cpp -o main
//本文小程序实现的是对/home/1.avi大小的计算。很简单,贴出来只是为了方便不知道的朋友
  2 #include <stdio.h>
  3 #include <stdlib.h>
  4 #include <sys/stat.h>
  5 #include <sys/types.h>
  6 #include <unistd.h>
  7 int main(int argc,char *argv[])
  8 {
  9     struct stat st;
 10     float size;
 11     if(stat("/home/1.avi",&st) == 0)
 12     {
 13         size =(((float)st.st_size)/1024)/1024;
 14         printf("the exe is : %f M\n",size);
 15
 16     }
 17
 18     return 0;
 19 }


相关文档:

C/C++笔试、面试题目汇总

1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx ++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&ldquo ......

C/C++ 路径为目录判断

#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
/****************************************************
* 函数功能: 判断参数路径是否为(正确的)目录
* 函数返回: 0为表示路径为文件,1为非目录.其他为错误
*    参数: path文件需要判断的目录的路径.
*  ......

linux命令系列之一

du wzwz -h                  查看目录或者文件wzwz占用空间的大小
ls -1                        &n ......

开启和关闭LINUX 放火墙的命令

这里给大家提供一个开启和关闭LINUX 放火墙的命令以及 如何查看防火墙是否安装和配置情况
      解决办法:
      关闭: /etc/rc.d/init.d/iptables stop
      启动: /etc/rc.d/init.d/iptables start
      查看当前配置:iptabl ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号