download.c

来自「下载程序,多线程下载,断点续传. 目前只能下http」· C语言 代码 · 共 52 行

C
52
字号
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include <stdarg.h>#include <ctype.h>#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>#include <unistd.h>#include <arpa/inet.h>#include <fcntl.h>#include <sys/time.h>#include <host.h>#include <ants.h>#include <http.h>#include <config.h>int main() {	int i, fd, thread;	struct mission my_mission;	struct mission *pms = &my_mission;	char name[MAX_HOSTNAME];	char referer[MAX_HOSTNAME];	char path[MAX_HOSTNAME] = "/usr/src/";	pms->file_path = path;	while(1) {		fd = scan_temp(path);		if(fd >= 1) {			i = rebuild_ants(fd, pms);			if(i) {				down_http(pms);			}		}		else {			printf("please input url.\n");			scanf("%s", name);			printf("please input referer.\n");			scanf("%s", referer);			if(strlen(referer) <= 3)				*pms->referer = 0;	/*auto fill*/			else				strcpy(pms->referer, referer);			printf("please input thread number : range 1-20\n");			scanf("%d",&thread);				build_ants(pms, name, &thread);			down_http(pms);		}	}	exit(0);	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?