In that case U've to write code which will include plenty of fseek(); to get to actaul position in file & replace them with new values of ur own.For that use file opening mode as "wb", so that U can replace content at file pointer.U may need to have code like this
Code:
struct rec {
int roll,t;
};
rewind(fp);
while(1) {
if(feof(fp))
break;
fread(&r,sizeof(r),1,fp);
if(r.roll == 2) {
if(fseek(fp,-sizeof(r),SEEK_CUR) != 0)
printf("\nseek error");
r.roll = 99;
fwrite(&r,sizeof(r),1,fp);
break;
}
}
U'll notice in fseek(); code, -ve offset value allows to go backward in file.As fread(); advances file pointer by specified offset & so file pointer points to next record,so u need to use -ve offset in fseek(); to reach beginning of previous record,in ur case it will be sample i.e. byte.Then u can use fwrite(); to write new value.
It may damage ur .wav file if u made mistakes during fseek(); & fwrite(); so take backup of it.