Author Topic: INI Files - changing, saving  (Read 787 times)

0 Members and 1 Guest are viewing this topic.

Offline Vyka

  • Major
  • *
  • Posts: 59
INI Files - changing, saving
« on: December 26, 2008, 07:11:40 pm »
Hey, have a little problem.
How to change ini file. for example i have to:

visits=100
rest=0

change to

visits=101
rest=0

I use read function created by rampage_terranius to read

and how to save it?

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: INI Files - changing, saving
« Reply #1 on: December 26, 2008, 07:45:42 pm »
Use the search function.

http://forums.soldat.pl/index.php?topic=22338.0

(Or you could just WriteLn('visits=101'), for the record, if you're looking for a quicker and more specific solution. :P)

Offline Vyka

  • Major
  • *
  • Posts: 59
Re: INI Files - changing, saving
« Reply #2 on: December 27, 2008, 06:20:39 am »
Thanks, i was reading it yesterday, but were a little drunk and dont remember exactly what i read.

Another Question:
Is it possible to create INI file by script?

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: INI Files - changing, saving
« Reply #3 on: December 27, 2008, 06:31:26 am »
Is it possible to create INI file by script?
Uh, yeah? There's WriteFile and WriteFileLn, which is pretty much all you need, and if you need something a bit more high level there is the script I've already linked you.

... I somehow doubt this was your actual question though, since it feels like you're asking the same thing twice, so if I misinterpreted you in any way do please elaborate a little bit on what you mean by "create INI file by script".

Offline Vyka

  • Major
  • *
  • Posts: 59
Re: INI Files - changing, saving
« Reply #4 on: January 03, 2009, 07:22:10 am »
ok, thanks, and one more question:

how to delete file? is it possible?

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: INI Files - changing, saving
« Reply #5 on: January 03, 2009, 07:36:17 am »
You could use shell_exec as long as the server isn't running in safe mode (for example, under Linux shell_exec('rm ./path/to/file.txt');).