11.09.2009, 07:41
pawn Код:
stock fdeleteline(filename[], dest[], remove[])
{
new string[255], File:handle, File:ftmp;
handle = fopen(filename, io_read);
ftmp = fopen(dest, io_write);
while(fread(handle, string)){
for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
if(strcmp(string, remove, false) != 0) fwrite(ftmp, string);
}
fclose(handle);
fclose(ftmp);
handle = fopen(filename, io_write);
ftmp = fopen(dest, io_read);
while(fread(ftmp, string)){
for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
fwrite(handle, string);
}
fclose(handle);
fclose(ftmp);
fremove(dest);
}
Код:
test1test2test3test4test5....
Код:
test1 test2 test3 test4 ....