I intend to copy file, i'm using function fgets to get each record and then put it into the new file....but......it doesn't work the destination file contains nothing,
handle=fopen("karyawan.dat","w"); // the destination file
temporer=fopen("temp.$$$","r"); // the source file
by the way......it seems to work...i mean i could exit the program..but when i check the file it's nothing......
Did you check all those functions for error returns?
And how is kodec declared.
i have checked it.....they work...i declared kodec as:
please help me.....it really confuses me.....:(
Should work if its a text file you're trying to copy.
But if it's a binary file (like a .exe), then it wont work.
Oh, and the opposite of fgets is fputs, not fprintf
Man.....i'm so sorry for wasting your time thinking about my stupid code......i have found the reason why it didn't work...I forgot to close the file (fclose(temporer) and fclose(handle)).....btw.....thank's for your kindness.....I'll be more carefull in the future :)