#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pthread.h>
#include<iostream>
#define MAX_PATH 255
#define BLOCK_SIZE 4096
typedef struct
{
int srcFd; //需要拷贝的文件描述符
int dstFd; //拷贝后的文件描述符
int start; //开始标记
int end_; //结束标记
} thread_info; //线程信息结构体
/*
函数名: mycopy
函数参数: 源文件路径+名称 目标文件路径+名称 线程数量
函数作用: 1.确立每个线程读取文件的起始点和结束点
2.确立文件描述符
3.开辟线程
*/
int mycopy(const char *src, const char *dst, int threads);
void *run(void *arg); //线程函数
pthread_t *tid = NULL; //线程id指针
thread_info *tinfo = NULL; //线程信息结构体指针
pthread_mutex_t mu;
int main(int argc, char *argv[])
{
/* if (argc != 4) //判断是否是四个参数(分别是可执行程序 源文件路径+文件名 目标文件路径+文件名 线程数量)
{
printf("usage: %s src dst sum_of_thread\n", argv[0]);
return -1;
}*/
char src[MAX_PATH] = {0}; //保存源文件名路径
char dst[MAX_PATH] = {0}; //保存目标文件路径
int threads; //线程变量
//memcpy(src, argv[1], strlen(argv[1])); //给源文件路径赋值
//memcpy(dst, argv[2], strlen(argv[1])); //给目标文件路径赋值
strcpy(src,"/home/linux/1.mp4");
strcpy(dst,"/home/linux/2.mp4");
//threads = atoi(ar