14.07.2010, 08:13
Hi, i am scripting script, it have to do delete line from soubor
for example : DelLine("testfile.txt","DelThisLine",10); //it have to delete word "DelThisLine" .. it doesn'n delete now it is just writing to console, but my problem is >
in file is :
hallo
DelThisLine
bye
and it will printf this .. i want to print just
hallo
bye .. code is here
Have a nice day .
for example : DelLine("testfile.txt","DelThisLine",10); //it have to delete word "DelThisLine" .. it doesn'n delete now it is just writing to console, but my problem is >
in file is :
hallo
DelThisLine
bye
and it will printf this .. i want to print just
hallo
bye .. code is here
Код:
stock DelLine(dir[],word[],linesInFolder) { new File:oldF; //new File:CopyF; //new File:completedF; new Line; oldF = fopen(dir,io_read); //CopyF = fopen("lRemoveDir.txt",io_append); new output[256]; if (oldF) { while (fread(oldF, output)) { if(Line < linesInFolder+2) { if(strcmp(output,word,false)) { printf(output); Line ++; } } } fclose(oldF); } return 1; }