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){ ...
阅读全文
摘要:#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); ...
阅读全文
摘要:clock()函数的头文件是time.h,基本结构如下:clock_t start,stop;start = clock();{要计时区域}stop = clock();printf(“time is %f”,(float)(stop - start)/CLOCKS_PER_SEC);其中CLOCKS_PER_SEC是系统常量,表示系统时钟滴答数。
阅读全文

浙公网安备 33010602011771号