01.06.2011, 14:06
pawn Код:
stock DINI_fcopytextfile(oldname[],newname[]) {
new File:ohnd,File:nhnd;
if (!fexist(oldname)) return false;
ohnd=fopen(oldname,io_read);
if (!ohnd) return false;
nhnd=fopen(newname,io_write);
if (!nhnd) {
fclose(ohnd);
return false;
}
new tmpres[DINI_MAX_STRING];
while (fread(ohnd,tmpres)) {
DINI_StripNewLine(tmpres);
format(tmpres,sizeof(tmpres),"%s\r\n",tmpres);
fwrite(nhnd,tmpres);
}
fclose(ohnd);
fclose(nhnd);
return true;
}