07.04.2009, 20:34
Hi I've a big problem i can't create this function :/ fdeleteline by Sacky doesn't work so not give me this
maybe u have your own function?
maybe u have your own function?
sd afd hgfgh gfjg 34v3g 4g234 jgdfg ghj
fdeleteline(filename[], line)
{
new count, string[256], File:file, File:temp;
file= fopen(filename, io_read);
temp = fopen("tmpfile.tmp", io_write);
while (fread(file, string))
if (++count != line)
fwrite(temp, string);
fclose(file);
fclose(temp);
file= fopen(filename, io_write);
temp = fopen("tmpfile.tmp", io_read);
while (fread(temp, string))
fwrite(file, string);
fclose(file);
fclose(temp);
fremove("tmpfile.tmp");
}
sd afd hgfgh gfjg
fdeleteline("file.txt", 3);
sd afd gfjg
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); }
sdf sffsfa dgsd dhfh dghfh
sdf sffsfa dgsd dhgfh