【求助】请问把wav切割成pcm这段代码哪儿错误 输出是一个字节的PCM
橘子吃汽水 2017-09-21 10:06:09
FILE *infile, *outfile;
char *buf = NULL;
long length;
if ((infile = fopen("11.wav", "rb+")) == NULL)
{
printf("Open the 1.wav failed\n");
return -1;
}
else
{
printf("Open the 1.wav success\n");
}
if ((outfile = fopen("2.pcm", "wb")) == NULL)
{
printf("Open the 2.pcm failed\n");
return -1;
;
}
else
{
printf("Open the 2.pcm success\n");
}
/*获取文件的长度*/
fseek(infile, 44, SEEK_SET);
length = ftell(infile);
buf = (char*)malloc(length - 43);
fwrite(buf, 1, length , outfile);
free(buf);
fclose(infile);
fclose(outfile);
把wav头44个做掉了在写进去