PDA

View Full Version : Dvd Raid...


jpyeron
3rd May 2005, 01:06
I have gotten tired of my wife ruining media, so I decided to RAID the discs in our album.

Does any one out there have any opinions about this?

Now we have a third disc for every 2 discs in our collection. My hope is next time she scratches a disc, I can rip the iso of each, note the read errors and repair.

I am doing this for my data CDs which I keep for this and that too.

jpyeron
3rd May 2005, 01:11
/*
(c) 2005 PD Inc, Jason Pyeron
Licensed under terms of GNU Public License.
*/

#include <stdio.h>

int main(int argc, char* argv[])
{

if (argc!=4)
{
printf("%s fileA.iso fileB.iso raid.iso\n",argv[0]);
return -1;
}


FILE* fileA=fopen(argv[1],"rb");
FILE* fileB=fopen(argv[2],"rb");
FILE* fileC=fopen(argv[3],"wb");

if (!fileA||!fileB)
{
printf("could not open files [%08x,%08x]\n",fileA,fileB);
return -2;
}

int A=1, B=1;

if (feof(fileA)) A=0;
if (feof(fileB)) B=0;

int a=0;
int b=0;

while (A||B)
{
if (A)
{
a=fgetc(fileA);
if (a==-1)
{
A=0;
a=0;
}
}

if (B)
{
b=fgetc(fileB);
if (b==-1)
{
B=0;
b=0;
}
}

if (A||B) fputc((char)(a^b),fileC);

}

fclose(fileA);
fclose(fileB);
fclose(fileC);

return 0;
}