![]() |
[Include] file2 - Versão de Impressão +- Portal SAMP (https://portalsamp.com) +-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5) +--- Fórum: Lançamentos (https://portalsamp.com/forumdisplay.php?fid=26) +---- Fórum: Includes (https://portalsamp.com/forumdisplay.php?fid=27) +---- Tópico: [Include] file2 (/showthread.php?tid=4068) |
[Include] file2 - zHypezinXzL - 12/10/2023 Link para download da include:
Funções fornecidas
fcreate
create a file
frename rename a file
fcopy
copy a file fbackup
creates a backup of the file fclear clears properties inside the file
fgetlines gets the number of lines the file has fkeyexist
checks if a key exists fkeyrename
rename a key
fkeyremove
remove a key
fsetstring
sets a string to a file fgetstring
get the string from a file fsetkeystring
sets a string from a Key in an file fsetkeyinteger
sets a integer from a Key in an file fsetkeyfloating sets a floating from a Key in an file fsetkeyboolean
sets a boolean from a Key in an file fgetkeystringex
stores the string of a key in a file in a variable fgetkeystring
gets a string from a Key in an file fgetkeyinteger
gets a integer from a Key in an file fgetkeyfloating
gets a floating from a Key in an file fgetkeyboolean
gets a boolean from a Key in an file fcreate (const file []) Params `file []` - file name Example ``` main () { fcreate ("file.ini"); } ``` Return 0 - file not created 1 - file created native fcreate (const file []); ~~~~~~~~~~ frename (const file [], const newfile []) Params `file []` - file name `newfile []` - new file name Example ``` main () { frename ("file.ini", "newfile.ini"); } ``` Return 0 - file not renamed 1 - file renamed native frename (const file [], const newfile []); ~~~~~~~~~~ fcopy (const file [], const destination [], const bool: copyifexists = true) Params `file []` - file name `destination []` - name of the file to be copied `bool: copyifexists` - copy if already exists (false - not) (true - yes) Example ``` main () { fcopy ("file.ini", "copy.ini"); // copy even if it already exists } ``` Return 0 - file not copied 1 - file copied native fcopy (const file [], const destination [], const bool: copyifexists = true); ~~~~~~~~~~ fbackup (const file []) Params `file []` - file name Example ``` main () { fbackup ("file.ini"); } ``` Return "" - file backup not performed "file.ini.backup[Y(0000)-M(00)-D(00)-H(00)-M(00)-S(00)]" - file backup performed native fbackup (const file []); ~~~~~~~~~~ fclear (const file []) Params `file []` - file name Example ``` main () { fclear ("file.ini"); } ``` Return 0 - not clean file 1 - clean file native fclear (const file []); ~~~~~~~~~~ fsetstring (const file [], const string [], const bool: jumpline = false); Params `file []` - file name `string []` - string to be set `bool: jumpline` - jump line Example ``` main () { fsetstring ("file.ini", "Hello!", true); } ``` Return (-1) - string not seted 0, 1, 2... - index set (used in 'fgetstring') native fsetstring (const file [], const string [], const bool: jumpline = false); ~~~~~~~~~~ fgetstring (const file [], const index); Params `file []` - file name `index` - string to be set Example ``` main () { print (fgetstring ("file.ini", 0)); } ``` Return this function returns only the stored value native fgetstring (const file [], const index); ~~~~~~~~~~ fgetlines (const file [], const key []) Params `file []` - file name `key []` - key name Example ``` main () { printf ("there is: %i keys in 'file.ini'", fgetlines ("file.ini")); } ``` Return 0 - there are no keys in the file 1, 2, 3... - value of keys native fgetlines (const file []); ~~~~~~~~~~ fkeyexist (const file [], const key []) Params `file []` - file name `key []` - key name Example ``` main () { fkeyexist ("file.ini", "key"); } ``` Return 0 - key not exist 1 - key exist native fkeyexist (const file [], const key []); ~~~~~~~~~~ fkeyrename (const file [], const key [], const newkey []) Params `file []` - file name `key []` - key name Example ``` main () { fkeyrename ("file.ini", "key", "key2"); } ``` Return 0 - key not renamed 1 - key renamed native fkeyrename (const file [], const key [], const newkey []); ~~~~~~~~~~ fkeyremove (const file [], const key []) Params `file []` - file name `key []` - key name Example ``` main () { fkeyremove ("file.ini", "key"); } ``` Return 0 - key not removed 1 - key removed native fkeyremove (const file [], const key []); ~~~~~~~~~~ fgetkeystringex (const file [], const key [], dest [], len = sizeof dest) Params `file []` - file name `key []` - key name `dest []` - destination variable `len` - target variable size Example ``` main () { new string [32]; // fgetkeystringex ("file.ini", "key", string, 32); | fgetkeystringex ("file.ini", "key", string, sizeof string); fgetkeystringex ("file.ini", "key", string); print (string); } ``` Return this function does not return any value native fgetkeystringex (const file [], const key [], dest [], len = sizeof dest); ~~~~~~~~~~ fsetkeystring (const file [], const key [], const value []) Params `file []` - file name `key []` - key name `value []` - value Example ``` main () { fsetkeystring ("file.ini", "key", "value"); } ``` Return 0 - value not seted 1 - value seted native fsetkeystring (const file [], const key [], const value []); native fsetkeyinteger (const file [], const key [], const _: value); native fsetkeyfloating (const file [], const key [], const Float: value); native fsetkeyboolean (const file [], const key [], const bool: value); ~~~~~~~~~~ fgetkeystring (const file [], const key []) Params `file []` - file name `key []` - key name Example ``` main () { fsetkeystring ("file.ini", "key"); } ``` Return this function returns only the stored value native fgetkeystring (const file [], const key []); native fgetkeyinteger (const file [], const key []); native fgetkeyfloating (const file [], const key []); native fgetkeyboolean (const file [], const key []); |