Here is the code:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * InputFile;
FILE * OutputFile;
char c;
char fc[3];
InputFile = fopen("Test.mp3","rb");
OutputFile = fopen("Test.txt","wb");
if (InputFile == NULL) {
perror ("Error while opening input file");
} else if (OutputFile == NULL) {
perror ("Error while creating output file");
} else {
while (!feof(InputFile)) {
c = fgetc (InputFile);
sprintf(fc,"%.3d",c); // 3-digit ASCII code, as 005, 068
fputs(fc,OutputFile); // putting string fc into the file
}
}
fclose(InputFile);
fclose(OutputFile);
printf("Done.\n");
return 0;
}