You can take a look inside BombStatus plugin, it has the feature to remove specific line from file. You can adapt that and work with it.
If you are too lazy:
PHP Code:
public plugin_init()
{
ChangeLine("Problems", "No Problems")
}
stock ChangeLine(const OldLine[], const NewLine[])
{
new const FileName[] = "file_testing.ini"
new const TempFileName[] = "tempfile.ini"
new ConfigDirPath[128]; get_configsdir(ConfigDirPath, charsmax(ConfigDirPath))
new FullPath[256]; formatex(FullPath, charsmax(FullPath), "%s/%s", ConfigDirPath, FileName)
new FilePointer = fopen(FullPath, "rt")
if(FilePointer)
{
new TempFilePath[256]; formatex(TempFilePath, charsmax(TempFilePath), "%s/%s", ConfigDirPath, TempFileName)
new InputFilePointer = fopen(TempFilePath, "wt")
if(InputFilePointer)
{
new FileData[128]
while(!feof(FilePointer))
{
fgets(FilePointer, FileData, charsmax(FileData))
trim(FileData)
if(equal(FileData, OldLine))
{
copy(FileData, charsmax(FileData), NewLine)
}
fprintf(InputFilePointer, "%s^n", FileData)
}
fclose(InputFilePointer)
fclose(FilePointer)
delete_file(FullPath)
rename_file(TempFilePath, FullPath, 1)
return 1
}
}
return 0
}
Note that this is just an example, to show you how it could be done. Further things depend on how you will use it(if you are going to call it many times, it would be good to cache all changes that needs to be done inside an array and do it during plugin_end and adjust the string on the fly).
__________________