> My main problem now is that when i make the 2 copys one file always comes out slightly diffrent than the other,
Probably because you're using eof() to test for the end of file, and not checking for the EOF result from the function which actually reads the file. As a result, you end up doing one more write (of garbage data) than you ought to do (the read fails with EOF, but you do a write anyway).
This C code copies files.
Code:
void copy_file ( char *from, char *to ) {
FILE *ifp = fopen( from, "rb" );
FILE *ofp = fopen( to, "wb" );
char buff[BUFSIZ];
int n;
while ( (n=fread(buff,1,BUFSIZ,ifp)) > 0 ) {
fwrite( buff, 1, n, ofp );
}
fclose( ifp );
fclose( ofp );
}