www.pudn.com > makewav.rar > makewav.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "wav.h"
int main(int argc, char *argv[])
{
FILE *sndfile;
FILE *infile;
int a;
long fileread;
if(argc!=3){
printf(" please input the pcm file and the txt file\n ");
return 1;
}
infile=fopen(argv[1],"r");
sndfile=fopen(argv[2],"wb");
fseek(infile, 0, SEEK_END);
fileread = ftell(infile);
printf(">d",fileread);
fseek(infile,0, SEEK_SET);
CreateWavHeader(sndfile, 2, 44100, 16);
while (!feof(infile))
{
fscanf(infile,">h",&amt;a);
fwrite(&amt;a,2,1,sndfile);
}
UpdateWavHeader(sndfile);
fclose(sndfile);
fclose(infile);
return 2;
}