Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Best Language for the job?

Name: Anonymous 2007-03-11 1:22 ID:V0b/AoE6

The problem is simple.
given a binary string of X(several megabytes)
it needs to be XORed with binary string Y(the same lenght).
The strings are read(converted) from files,and then results written to third file.After which a shell script is
performed on the third file.

The question is:Which language this problem is best coded in? (best=least code size,and the solution must work on Gigabyte+ files)

Name: Anonymous 2007-03-11 3:59 ID:rIy/dn7y

c you fags

int main(){FILE *a,*b,*c;int d,e;a=fopen("X","rb");b=fopen("Y","rb");c=fopen("Z","wb");
while((d=getc(a))!=EOF && (e=getc(b))!= EOF) putc(d^e,c);
return 0;
}

Name: Anonymous 2007-03-11 4:15 ID:Heaven

>>10
newlines are not a bad thing.
and i agree, C is the best language for something like this.
int main(){
 FILE *a,*b,*c;
 int d,e;
 a=fopen("X","rb");
 b=fopen("Y","rb");
 c=fopen("Z","wb");
 while((d=getc(a))!=EOF && (e=getc(b))!= EOF)
  putc(d^e,c);
 return 0;
}

Name: Anonymous 2007-03-11 10:57 ID:n/C1dcQY

int main(){
 char *a[3]={"X","Y","Z"};
 char *b[3]={"rb","rb","wb"};
 FILE *c[3];
 for(int i=0;i<3;c[i]=fopen(a[i],b[i]);
 for(int d,e;d-getc(f[0])!=EOF&&e=getc(f[1])!=EOF;putc(d^e,c[2]);
 return 0;
}

Name: 15 2007-03-11 10:58 ID:Heaven

oops, typo...
int main(){
 char *a[3]={"X","Y","Z"};
 char *b[3]={"rb","rb","wb"};
 FILE *c[3];
 for(int i=0;i<3;c[i]=fopen(a[i],b[i]);
 for(int d,e;d=getc(f[0])!=EOF&&e=getc(f[1])!=EOF;putc(d^e,c[2]);
 return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List