Need some help with fdeleteline
#2

I've tried this aswell but it doesn't work.

pawn Код:
public fdeleteline(filename[], line[]){
    if(fexist(filename)){
        new temp[256];
        new File:fhandle = fopen(filename,io_read);
        fread(fhandle,temp,sizeof(temp),false);
        if(strfind(temp,line,true)==-1){return 0;}
        else{
            fclose(fhandle);
            fremove(filename);
            for(new i=0;i<strlen(temp);i++){
                new templine[256];
                strmid(templine,temp,i,i+strlen(line));
                if(strcmp(templine, line, true) == 0){
                    strdel(temp,i,i+strlen(line));
                    fcreate(filename);
                    fhandle = fopen(filename,io_write);
                    fwrite(fhandle,temp);
                    fclose(fhandle);
                    return 1;
                }
            }
        }
    }
    return 0;
}
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)