Need some help with fdeleteline
#1

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);
}
I need someone to help modify that code so instead of rewriting the file like this:
Код:
 test1test2test3test4test5....
It writes it like this:
Код:
test1
test2
test3
test4
....
Cheers.
Reply


Messages In This Thread
Need some help with fdeleteline - by Gappy - 11.09.2009, 07:41
Re: Need some help with fdeleteline - by Gappy - 11.09.2009, 09:04

Forum Jump:


Users browsing this thread: 1 Guest(s)