Advertisement
OtaconEvil

[CODE] DeleteFileLine | By OTACON[

Dec 26th, 2014
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.79 KB | None | 0 0
  1. stock DeleteFileLine(file[],line_remove,max_str,max_line){
  2.     new
  3.             d[max_str],
  4.             File:dd,
  5.             line[max_line][max_str],
  6.             count=0,
  7.             data[max_str];
  8.  
  9.     if(!fexist(file))return false;
  10.     if(fexist(file)){
  11.         dd=fopen(file, io_read);
  12.         if(dd){
  13.             while(fread(dd, d)){
  14.                 StripNewLine(d);
  15.                 format(line[count],max_str,"%s",d);
  16.                 count++;
  17.             }fclose(dd);
  18.         }
  19.         dd=fopen(file, io_write);
  20.         if(dd){
  21.             for(new line=0; line<count; line++){
  22.                 if(line==line_remove)continue;
  23.                 format(data, sizeof(data), "%s\r\n", line[line]);
  24.                 fwrite(dd, data);
  25.             }fclose(dd);
  26.         }
  27.     }return true;
  28. }
  29.  
  30. /*
  31. EJEMPLO:
  32.  
  33. #define MAX_LINE_FILE   (20)
  34. #define MAX_STR_LINE    (128)
  35. #define LINE_REMOVE     (14)
  36. DeleteFileLine("archivo.txt",LINE_REMOVE,MAX_STR_LINE,MAX_LINE_FILE);
  37.  
  38. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement