SA-MP Forums Archive
need help with saving a file (+rep) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help with saving a file (+rep) (/showthread.php?tid=329147)



need help with saving a file (+rep) - WardenCS - 27.03.2012

Hello,i have this kinda system.it saves the settings, but when it saves it creates new numbers,not edit the old ones,how to make it edit the old one what is already saved?

pawn Код:
public SaveSettings()
{
        new File: file2;
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d|%d|%d|%d|%d|%d|%d|",
        Settings[Tax],
        Settings[SFPDpc],
        Settings[FBIpc],
        Settings[EMSpc],
        Settings[FIREpc],
        Settings[hBill],
        Settings[GovCash]);
        file2 = fopen("MPRP/Settings.cfg", io_append);
        fwrite(file2, coordsstring);
        fclose(file2);
        return 1;
}



Re: need help with saving a file (+rep) - Harish - 27.03.2012

Try using dini its very simple and best to work..here is the link https://sampforum.blast.hk/showthread.php?tid=50 and help link here https://sampwiki.blast.hk/wiki/Useful_Fu....28Dini.inc.29
or with the same type you posted use io_write. it will overwrite the file


Re: need help with saving a file (+rep) - Reklez - 27.03.2012

Quote:
Originally Posted by Harish
Посмотреть сообщение
Try using dini its very simple and best to work..here is the link https://sampforum.blast.hk/showthread.php?tid=50 and help link here https://sampwiki.blast.hk/wiki/Useful_Fu....28Dini.inc.29
or with the same type you posted use io_write. it will overwrite the file
Think before posting, dini is old, compare dini to latest ini saving system. everyone votes that dini is slow.
try changing io_append to io_write


Re: need help with saving a file (+rep) - [ABK]Antonio - 27.03.2012

Quote:
Originally Posted by Reklez
Посмотреть сообщение
Think before posting, dini is old, compare dini to latest ini saving system. everyone votes that dini is slow.
try changing io_append to io_write
Lol at this post - It's easier to write with dini for beginners. I believe it's good enough in that perspective.


Re: need help with saving a file (+rep) - Harish - 27.03.2012

In my server i'm using dini that's why i posted.sorry if i make any mistakes..thanks for your reply