1.包含头文件
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
2.定义文件句柄
FILE * inDataFd;
3.创建文件
filter->inDataFd= fopen("/data/xx/hwdataintmp.pcm","ab+");
if(NULL == filter->inTmpDataFd){
ALOGV("open file,failed in tmp \n");
}
4.写文件
fwrite(out,1,frameSizeToByteSize(frames),filter->inDataFd);
5.同步文件内容,关闭文件
fflush(filter->inDataFd);
fclose(filter->inDataFd);
原文:http://www.cnblogs.com/leaven/p/5830273.html