当前位置: 技术问答>linux和unix
像这种隐藏的错误,应该怎么查找?
来源: 互联网 发布时间:2016-12-04
本文导语: 本来错误出现在字符串拷贝上,但运行时“似乎”提示在foef()里, #include #include // exit() #include // bzero() #include #include #include #include /*stat用到*/ #define TMEP_BUFFER_SIZE 200 #define STRUCT struct RIFF...
本来错误出现在字符串拷贝上,但运行时“似乎”提示在foef()里,
#include
#include // exit()
#include // bzero()
#include
#include
#include
#include /*stat用到*/
#define TMEP_BUFFER_SIZE 200
#define STRUCT
struct RIFF_HEADER
{
char szRiffID[4]; // 'R','I','F','F'
unsigned int dwRiffSize; // 整个wav文件大小减去szRiffID和szRiffFormat所占用的字节数
char szRiffFormat[4]; // 'W','A','V','E'
};
int main(int argc,char* argv[])
{
FILE *wav_in;
FILE *wav_out;
int ret;
if(argc != 3 )
{
printf("Usage:nt%s n", argv[0]);
exit(-1);
}
wav_in = fopen(argv[1],"rb");
if(wav_in == NULL)
{
printf("Can't open input file %sn", argv[1]);
return (-1);
}
wav_out = fopen(argv[2],"wb");
if(wav_out == NULL)
{
printf("Can't open input file %sn", argv[1]);
return (-1);
}
#ifndef STRUCT
char str[] = "abcdefg";
ret = fwrite(str,sizeof(str),1,wav_out);
if(ret