04 2013 档案

摘要:#include<stdio.h>#include<stdlib.h>#include<sys/wait.h>#define MAXLINE 4096int main(){ char buf[MAXLINE]; pid_t pid; int status; while(fgets(buf,MAXLINE,stdin) != NULL){ if(buf[strlen(buf) - 1] == '\n') buf[strlen(buf) - 1] = 0; if((pid = fork()) < 0){ ... 阅读全文
posted @ 2013-04-06 14:27 孤独的小马哥 阅读(485) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>#include<dirent.h>int main(int argc,char **argv){ DIR *dp; struct dirent *dirp; if(argc != 2){ printf("usage:ls directory_name\n"); exit(0); } if((dp = opendir(argv[1])) == NULL){ printf("can not open\n"); exit(0); ... 阅读全文
posted @ 2013-04-06 13:55 孤独的小马哥 阅读(209) 评论(0) 推荐(0)
摘要:clock()函数的头文件是time.h,基本结构如下:clock_t start,stop;start = clock();{要计时区域}stop = clock();printf(“time is %f”,(float)(stop - start)/CLOCKS_PER_SEC);其中CLOCKS_PER_SEC是系统常量,表示系统时钟滴答数。 阅读全文
posted @ 2013-04-03 17:13 孤独的小马哥 阅读(173) 评论(0) 推荐(0)
摘要:添加-Xcompiler-fopenmp 选项。 阅读全文
posted @ 2013-04-03 12:20 孤独的小马哥 阅读(448) 评论(0) 推荐(0)