Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock DeleteFileLine(file[],line_remove,max_str,max_line){
- new
- d[max_str],
- File:dd,
- line[max_line][max_str],
- count=0,
- data[max_str];
- if(!fexist(file))return false;
- if(fexist(file)){
- dd=fopen(file, io_read);
- if(dd){
- while(fread(dd, d)){
- StripNewLine(d);
- format(line[count],max_str,"%s",d);
- count++;
- }fclose(dd);
- }
- dd=fopen(file, io_write);
- if(dd){
- for(new line=0; line<count; line++){
- if(line==line_remove)continue;
- format(data, sizeof(data), "%s\r\n", line[line]);
- fwrite(dd, data);
- }fclose(dd);
- }
- }return true;
- }
- /*
- EJEMPLO:
- #define MAX_LINE_FILE (20)
- #define MAX_STR_LINE (128)
- #define LINE_REMOVE (14)
- DeleteFileLine("archivo.txt",LINE_REMOVE,MAX_STR_LINE,MAX_LINE_FILE);
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement