70,027
社区成员




#define BUFFER_SIZE 512
char total[BUFFER_SIZE];
char cell1[BUFFER_SIZE];
char cell2[BUFFER_SIZE*2];
char cell3[BUFFER_SIZE*3];
char rBuffer[BUFFER_SIZE];
memset(total, '\0', BUFFER_SIZE);
memset(cell1, '\0', BUFFER_SIZE);
memset(cell2, '\0', BUFFER_SIZE*2);
memset(cell3, '\0', BUFFER_SIZE*3);
memset(rBuffer, '\0', BUFFER_SIZE);
int flenth = 0;
int rlenth = 0;
int num = 0;
int i = 0;
int a = 0;
FILE *fpCon = NULL;
fpCon = fopen("333.txt","r");
if(fpCon == NULL){
printf("读取文件错误\n");
return 1;
}
while(fgets(rBuffer, BUFFER_SIZE, fpCon))
{
//判断跳过文件头部注释
if ((rBuffer[0] == '#') || (rBuffer[0] == '\n')){
continue;
}
flenth = strlen(total);
rlenth = strlen(rBuffer);
if(flenth < BUFFER_SIZE){
strncat(total, rBuffer, BUFFER_SIZE-flenth);
flenth = strlen(total);
}
if(flenth == BUFFER_SIZE)
{
memcpy(cell1, total, BUFFER_SIZE);
memcpy(cell2, total, BUFFER_SIZE);
memcpy(cell2+BUFFER_SIZE, total, BUFFER_SIZE);
memcpy(cell3, total, BUFFER_SIZE);
memcpy(cell3+BUFFER_SIZE, total, BUFFER_SIZE);
memcpy(cell3+2*BUFFER_SIZE, total, BUFFER_SIZE);
printf("复制完毕\n");
if(fpCon != NULL){
fclose(fpCon);
}
break;
}
memset(rBuffer, '\0', BUFFER_SIZE);
}
//调用发送函数
mysend();