As a fun project I thought I'd write a program to make iso files. As far as I can tell it works, but it reads only 4KB every 30 seconds. I used eject -x 11 to slow my cdrom drive to a reasonable speed. Without it the drive runs at full speed and kills the process pretty quickly. Any suggestions to make this faster/better will be much appreciated.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define BUFFSIZE 4092
int main(int argc, char **argv)
{
FILE *fp = fopen("/dev/cdrom", "r");
FILE *file = fopen(strcat(argv[1], ".iso"), "w");
printf("Copying...\n");
while(!feof(fp))
{
char *line=(char *)malloc(sizeof(char) * BUFFSIZE);
fgets(line, BUFFSIZE, fp);
fprintf(file, "%s",line);
free(line);
}//end while
fclose(fp);
fclose(file);
printf("Done!\n");
return 0;
}//end main