#include "main.h" #include <stdio.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <limits.h> #include <signal.h> #include <string.h> #include <stdlib.h> int main() { short buf[480] = {0}; int ret = -1; FILE* pwav = fopen("mymic.wav","wb"); // wb打开有会自动删除 if( pwav== NULL) { printf("pwav is NULL "); } memset(buf,1,960); // sprintf(buf,"hello"); // strcpy和sprintf都可以 strcpy((char*)buf,"world"); //size_t ret = fwrite(buf,480*2,1,pwav); fprintf(pwav,"%s ","hello"); // fprintf(pwav,"%s ","mygirl"); // printf("ret is %d ",ret); fputs("www.baidu.com ",pwav); // 和 fputs("2020/9/18 ",pwav); fflush(pwav); // 没有fflush 文件里面什么都没有 getchar(); fclose(pwav); for(;;); return 0; }