#define DEST_FILE_NAME "dest_file.dat"
//输出金额到.dat文件
int dest_file;
dest_file=open(DEST_FILE_NAME,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if(dest_file<0)
{
printf("open the dest file error\n");
exit(1);
}
if((write(dest_file,a,i)&&write(dest_file,tmp,sizeof(tmp)))<0)
{
printf("write the dest file error\n");
exit(1);
}
close(dest_file);
//输出金额到.dat文件
unsigned long int b[1];
b[0]=count;
int dest_file;
dest_file=open(DEST_FILE_NAME,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if(dest_file<0)
{
printf("open the dest file error\n");
exit(1);
}
if((write(dest_file,b,4))<0)
{
printf("write the dest file error\n");
exit(1);
}
close(dest_file);