I try to copy a file in a new file but it doesn't work because the input is 5133KB and the output is 614byte... what's wrong? Thank you in advance.
FILE * input = fopen("input.wav", "r");
FILE * output = fopen("output.wav", "w");
int bytesRead = 1;
You may need to open the file in binary mode on your system. From C.2011, §188.8.131.52:
rbopen binary file for reading
wbtruncate to zero length or create binary file for writing
FILE * input = fopen("input.wav", "rb"); FILE * output = fopen("output.wav", "wb");
The reason is that on some systems, certain embedded binary characters may cause the text mode processing to believe the end of file has been encountered, even though there are actually more bytes in the file.