#151615 - darkchild - Sat Mar 01, 2008 3:37 pm
can someone whip me up a file copying function?
I can't seem to get mine working :(
here's the code if you are interested:
If you help, your name will be on the credits of my program (iFile)
I can't seem to get mine working :(
here's the code if you are interested:
Code: |
int copyfile(char input[], char output[])
{ bool error; FILE *from, *to; char ch; if((from = fopen(input, "rb"))==NULL) { error = true;} if (error == false) { if((to = fopen(output, "wb"))==NULL) { error = true; } } if (error == false) { while(!feof(from)) { ch = fgetc(from); if(ferror(from)) { error = true; } } if (error == false) { if(!feof(from)){ fputc(ch, to); } } if(ferror(to)) { error = true; } fclose(from); fclose(to); } if (error == true) { return -1;} else { return 0; } } |
If you help, your name will be on the credits of my program (iFile)