Renaming a file in Pawn
If you are using pawn (for instance in san andreas multiplayer) and want to rename a file, you'll not find a method like frename.
You can either use my dutils (pawn only solution) or a plugin (like Yless' YSF) to add frename to your functions.
If you want to make a plain pawn solution, and don't want to use dutils, here is how I made it.
There are two steps.
First you'll need fcopy (copies the file):
2
3
4
5
6
7
8
9
nhnd=fopen(newname,io_write);
new buf2[1];
new i;
for (i=flength(ohnd);i>0;i--) {
fputchar(nhnd, fgetchar(ohnd, buf2[0],false),false);
}
fclose(ohnd);
fclose(nhnd);
And then you'll need to remove the old file.
Remember, that on linux those methods will not work (since fputchar is bugged on linux). You need to use the pawnonly frenametextfile and fcopytextfile from dutils for that.
Messages
thank you
nhnd=fopen(newname,io_write);
we


