wav파일header파일 도움받아서 다완성됫는데, 여기서헷갈리네요..도와주세요
댓걸
질문 제목 :
wav파일header파일 도움받아서 다완성됫는데, 여기서헷갈리네요..도와주세요
wav파일 header파일 여기서 도움받아서 다짯는데 맞는건지잘모르겟습니다.
질문 내용 :
#includestdio.h
#includestdlib.h
struct headertype {
long riff; //riff header
char ni1 [18]; //not important
unsigned int channels; //channels 1 = mono; 2 = stereo
long frequency; //sample frequency
char ni2 [6]; //not important
char bitres; //bit resolution 8/16 bit
char ni3 [12]; //not important
};
void main(void)
{
file *fp;
struct headertype h;
fp = fopen(thunder.wav, rb);
if (fp == 0) {
printf(파일을 열 수 없으무니다\n);
exit(1);
}
fread(&h, sizeof(struct headertype), 1, fp);
//예를 들어서 채널을 보고 싶으면
printf(채널 = %d, h.channels);
fclose(fp);
}
1.실행햇는데 채널은 mono이면 1또는 streo이면 2가떠야하는게아닌가요?8000이뜨는데 어디서잘못됫을까요??
2.
long riff; //riff header
char ni1 [18]; //not important
unsigned int channels; //channels 1 = mono; 2 = stereo
long frequency; //sample frequency
char ni2 [6]; //not important
char bitres; //bit resolution 8/16 bit
char ni3 [12]; //not important
여기서
채널을 보고싶으면이렇게한는데
printf(채널 = %d, h.channels);
그럼 다른거 char bitres를보고싶으면 printf(비트=%s,h.bitres)
이렇게 %s로받나요??