Remove an line from .txt file
#1

Hi guys

I have .txt file with skins,for example:

Код:
0
1
2
3
4
10
15
20
50
128
I want to make that I can add/delete skins IG!Adding skin is simple,but problem is remove line.

I'm try with this function:
Код:
fdeleteline(filename[], removed[])
{
	new string[64], str[32], File:handle, File:ftmp;
	handle = fopen(filename,io_read);
	format(str,sizeof(str),"%s.part",filename);
	ftmp = fopen(str,io_write);
	while(fread(handle,string))
		if(strfind(string,removed) == -1)
			fwrite(ftmp,string);
	fclose(handle);
	fclose(ftmp);
	handle = fopen(filename,io_write);
	ftmp = fopen(str,io_read);
	while(fread(ftmp,string))
		fwrite(handle,string);
	fclose(handle);
	fclose(ftmp);
	return fremove(str);
}
Problem is when I use this:
fdeleteline("skins.txt","0");
So I want that he delete 0 skin,he will delete 10,20,50 ...I don't know how to fix this..
Reply


Messages In This Thread
Remove an line from .txt file - by GospodinX - 09.08.2018, 22:05
Re: Remove an line from .txt file - by GospodinX - 10.08.2018, 15:12
Re: Remove an line from .txt file - by [WSF]ThA_Devil - 10.08.2018, 15:36
Re: Remove an line from .txt file - by jlalt - 10.08.2018, 16:19
Re: Remove an line from .txt file - by GospodinX - 10.08.2018, 19:57
Re: Remove an line from .txt file - by Logic_ - 10.08.2018, 20:19
Re: Remove an line from .txt file - by Jefff - 10.08.2018, 20:33
Re: Remove an line from .txt file - by jlalt - 11.08.2018, 16:10
Re: Remove an line from .txt file - by denNorske - 11.08.2018, 16:34
Re: Remove an line from .txt file - by GospodinX - 11.08.2018, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)