#include
#include
int main() {
FILE *fin,*fout;
char buffer[1028];
int readcount=0;
short NumChannels = 1;
short
I know nothing about the file formats, but I find it hard to believe they would have a binary header followed by ascii data. So the use of fgets and fputs I find questionable since fgets looks for a \n terminator. So you could be losing data if the buffer fills up before it happens to find a \n ( 0xa ) byte.
while(!feof(fin))
{
fgets(buffer,sizeof(buffer),fin);
fputs(buffer,fout);
}
Something like this would make more sense
size_t n;
while((n = fread(buffer, 1, sizeof(buffer), fin)) > 0) {
if(n != fwrite(buffer, 1, n, fout)) {
perror("fwrite");
exit(1);
}
}
if(n < 0) {
perror("fread");
exit(1);
}
Also, why do you close fout and then reopen it?