toribio

toribio

Mar 6th, 2010
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. stock EraseLineByString(filename[], string[], bool:case=true)
  2. {
  3.     new File:temp = fopen("temp.tmp", io_write),
  4.         File:pfile = fopen(filename, io_read),
  5.         tmp[256];
  6.        
  7.     if(!fexist(filename))
  8.         return 0;
  9.        
  10.     while(fread(pfile, tmp))
  11.     {
  12.         if(strfind(tmp, string, case)) //caso a linha seja a string
  13.             continue;
  14.         fwrite(temp, tmp);
  15.     }
  16.     fclose(temp);
  17.     fclose(pfile);
  18.     fremove(filename);
  19.     temp = fopen("temp.tmp", io_read);
  20.     pfile = fopen(filename, io_write);
  21.     while(fread(temp, tmp))
  22.         fwrite(pfile, tmp);
  23.     fclose(temp);
  24.     fclose(pfile);
  25.     fremove("temp.tmp");
  26.     return 1;
  27. }
Add Comment
Please, Sign In to add comment