#include <stdio.h>
#include <process.h>
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <iosfwd>
#define PATH "path.."
using namespace std;
void Padding()
{
FILE *file_in,*file_out;
file_in=fopen("Gb1s1920.zf","rb+");
unsigned char padding_buffer[15*60*94]={0};
int length;
length=fread(padding_buffer,sizeof(unsigned char),15*60*94,file_in);
printf("%d\n",length);
file_out=fopen("padding.dat","wb+");
length=fwrite(padding_buffer,sizeof(unsigned char),15*60*94,file_out);
printf("%d\n",length);
fcloseall();
}
void Combine()
{
//在padding后追加
FILE *file_head,*file_tail;
unsigned char comb_buffer[60*94]={0};//一个区的大小
file_head=fopen("padding.dat","ab+");
file_tail=fopen("Gb1s1920.hz","rb+"); //可读的
int length;
length=fread(comb_buffer,sizeof(unsigned char),60*94,file_tail);
printf("读取此区长度为%d\n",length);
int count=1;
while(length==60*94)
{
fwrite(comb_buffer,sizeof(unsigned char),60*94,file_head);
length=fread(comb_buffer,sizeof(unsigned char),60*94,file_tail);
printf("读取此区长度为%d\n",length);
count++;
}
printf("共%d区\n",count);
fcloseall();
}
int main()
{
Padding();
Combine();
return 0;
}