Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock EraseLineByString(filename[], string[], bool:case=true)
- {
- new File:temp = fopen("temp.tmp", io_write),
- File:pfile = fopen(filename, io_read),
- tmp[256];
- if(!fexist(filename))
- return 0;
- while(fread(pfile, tmp))
- {
- if(strfind(tmp, string, case)) //caso a linha seja a string
- continue;
- fwrite(temp, tmp);
- }
- fclose(temp);
- fclose(pfile);
- fremove(filename);
- temp = fopen("temp.tmp", io_read);
- pfile = fopen(filename, io_write);
- while(fread(temp, tmp))
- fwrite(pfile, tmp);
- fclose(temp);
- fclose(pfile);
- fremove("temp.tmp");
- return 1;
- }
Add Comment
Please, Sign In to add comment