#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int NN=6;
int main()
{
short cc[6];
short aa[3]={ 1, 2, 3};
short bb[3]={ 4,5,6 };
short dd[3],ee[3];
memcpy( cc , aa , 3 * sizeof(short));
memcpy( cc + 3 , bb , 3 * sizeof(short));
cout<< cc[0]<<endl;
cout<< cc[1]<<endl;
cout<< cc[2]<<endl;
cout<< cc[3]<<endl;
cout<< cc[4]<<endl;
cout<< cc[5]<<endl;
FILE * fp_out_ns ;
fp_out_ns = fopen("out.txt" ,"w");
fwrite( cc , sizeof( short ), 6, fp_out_ns);//fp_out_ns是去噪之后的文件
fclose(fp_out_ns);
FILE * read1;
read1 = fopen( "out.txt" ,"rb");
fread(dd,sizeof(short) ,3,read1);
cout<< dd[0]<<endl;
cout<< dd[1]<<endl;
cout<< dd[2]<<endl;
return 0;
}
结果:
1
2
3
4
5
6
1
2
3