i was able to open the .wav file using c program, but while reading,its not reading the full file.i opened the .wav file in visual cpp and compared it with the program output.so many data missing.its reading only less than 1/4th of the file.no error is shown by the program.so how can i read a wav file correctly in the hex format.my program is given below.
[code]
#include<stdio. h>
#include<conio. h>
void main()
{
int i;
long n;
FILE *f1;
clrscr();
printf("the data output is \n\n");
f1=fopen("silen ce.wav","r");
while(feof(f1)= =0)
{
i=getw(f1);
if(ferror(f1)!= 0)
{
printf("\n an error has occurred"); just to check if any error occured.
n=ftell(f1);
printf("\n\nthe value of n is %ld",n);
getch();
}
printf("%x ",i);
}
n=ftell(f1);
printf("\n\nthe value of n is %ld",n);
fclose(f1);
printf("\n\n end of the file");
getch();
}
[code]
[code]
#include<stdio. h>
#include<conio. h>
void main()
{
int i;
long n;
FILE *f1;
clrscr();
printf("the data output is \n\n");
f1=fopen("silen ce.wav","r");
while(feof(f1)= =0)
{
i=getw(f1);
if(ferror(f1)!= 0)
{
printf("\n an error has occurred"); just to check if any error occured.
n=ftell(f1);
printf("\n\nthe value of n is %ld",n);
getch();
}
printf("%x ",i);
}
n=ftell(f1);
printf("\n\nthe value of n is %ld",n);
fclose(f1);
printf("\n\n end of the file");
getch();
}
[code]
Comment