资源简介
非常好的Qt程序 软件工程的程序 可以作为很好的参考

代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
static void usage(char *prog_name)
{
printf(“LIST 1.0 by Jiang jiangyanjun0718@163.com “__DATE__“ “__TIME__“\n“
“Usage: %s [OPTION]... [FILE]...\n“
“List information about the FILEs (the current directory by default)\n\n“
“ -? --help Display this help and exit\n“
“ -a --all Do not hide entries starting with .\n“
“ -r --recursive List subdirectories recursively\n“
“ -l --low= Minimum of file size\n“
“ -h --high= Maximum of file size\n“
“ -m --mdays= Limit file last modified time\n\n“ prog_name);
}
static struct option longopts[] = {
{ “help“ no_argument NULL ‘?‘ }
{ “all“ no_argument NULL ‘a‘ }
{ “recursive“ no_argument NULL ‘r‘ }
{ “low“ required_argument NULL ‘l‘ }
{ “high“ required_argument NULL ‘h‘ }
{ “mdays“ required_argument NULL ‘m‘ }
{ 0 }
};
static unsigned int recur = 0 all = 0 low = 0 high = 0xffffffff mtime = 0;
static void list(char *name int expand)
{
char path[1024];
DIR *dir;
struct dirent *ent;
struct stat st;
strcpy(path name[0] ? name : “.“);//鑻ヨ緭鍏ヤ负绌猴紝琛ㄧず褰撳墠鐩綍锛涜礋璐e皢鍏惰祴缁檖ath
if (stat(path &st) == -1) {
fprintf(stderr “%s: %s\n“ name strerror(errno));
return;
}
if (S_ISREG(st.st_mode)) {//鍒ゆ柇鏄惁鏄竴涓父瑙勬枃浠?
if (st.st_size >= low && st.st_size <= high && st.st_mtime >= mtime)
printf(“%10d %s\n“ st.st_size name);
return;
}
if (S_ISDIR(st.st_mode) && expand) {
if ((dir = opendir(path)) == NULL) {
fprintf(stderr “%s: %s\n“ name strerror(errno));
return;
}
while ((ent = readdir(dir)) != NULL) {
if (strcmp(ent->d_name “.“) == 0 || strcmp(ent->d_name “..“) == 0)//蹇界暐.鍜?.
continue;
if (!all && ent->d_name[0] == ‘.‘)//鑻ll == 0 涓?鏂囦欢鐨勭涓€涓瓧绗︿负‘.‘
continue;
sprintf(path “%s%s%s“ name name[0] ? “/“ : ““ ent->d_name);
list(path recur);//閫氳繃recur鐨勫€兼潵鎵ц鏄惁閫掑綊
}
closedir(dir);
}
}
int main(int argc char **argv)
{
int k opt;
while ((opt = getopt_long(argc argv “arl:h:m:?“ longopts NULL)) != -1)
switch (opt) {
case ‘?‘: usage(argv[0]); exit(0);
case ‘r‘: recur = 1; break;
case ‘a‘: all = 1; break;
case ‘l‘: low = atoi(optarg); break;
case ‘h‘: high = atoi(optarg); break;
case ‘m‘: mtime = time(0) - atoi(optarg) * 86400; break;
}
if (optind == argc)
list(““ 1);
else
for (k = optind; k < argc; k++)
lis
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-05-26 17:16 server\
文件 3184 2013-05-17 00:30 server\a.cpp
文件 80 2013-05-17 00:30 server\a.h
文件 1154 2013-05-24 12:10 server\main.cpp
文件 343 2013-05-23 19:01 server\server.pro
文件 17679 2013-05-26 17:16 server\server.pro.user
文件 27823 2013-05-20 20:49 server\server.pro.user.2.5pre1
目录 0 2013-05-25 00:19 slave\
文件 918 2010-04-21 09:25 slave\globals.h
文件 177 2013-05-25 00:09 slave\main.cpp
文件 7450 2013-05-04 22:21 slave\sensor.cpp
文件 927 2010-04-24 11:19 slave\sensor.h
文件 10019 2013-05-25 00:19 slave\slave.cpp
文件 1124 2010-04-24 09:54 slave\slave.h
文件 457 2013-05-25 00:14 slave\slave.pro
文件 17674 2013-05-25 00:19 slave\slave.pro.user
文件 639 2013-05-25 00:09 slave\slave.ui
文件 6904 2013-05-04 22:20 slave\slavethread.cpp
文件 485 2010-04-24 09:50 slave\slavethread.h
- 上一篇:A1超级aWp专用精悍CS1.5脚本
- 下一篇:京东多线程版易语言源码
相关资源
- 数据结构课件(北邮)
- 基于51单片机的智能温控器
- 台达PLC与485温控仪通讯
- 智能分户供暖监控系统的无线温控器
- 基于LM35温度传感器的温控系统设计
- 信号与系统郑君里北邮课件
- 卫星通信知识点总结不包含计算题
- 中央空调室内智能温控器设计论文、
- 北邮 现代交换原理实验 sip电话 抓包
- 分布式温控系统,北邮软件工程作业
- 北邮高操期末试题答案及知识点总结
- 北邮2015-2016专硕概率论与随机过程期
- 分布式温控系统
- 信号与系统——北邮课件.pptx
- 北邮大二上计算机系统基础.rar
- 北邮软件工程-分布式温控系统
- 光纤通信PDF课件---北邮
- 基于WinDLX的CPU流水线观察实验报告北
- 基于模糊控制与神经网络的智能PID温
- 基于西门子S7-300 PLC的锅炉内胆水温控
- 改进的模糊Smith串级主汽温控制仿真研
- 图像视频处理coursework
- 北邮2016年通信原理801考研真题
- 北邮-计算机网络期末试题含答案
- 北邮软件工程试题.zip
- 计算机网络第五版中文参考答案.zip
- 北邮《下一代Internet技术》 官方2017计
- 北邮宽带通信网原理
- 低频功率放大器电路图
- 北邮考研通原模拟题第三套--带参考答
评论
共有 条评论