mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
added natives
This commit is contained in:
parent
205f3734cd
commit
8ef66cee8c
@ -33,3 +33,49 @@ native file_exists(const file[]);
|
|||||||
* and when flags is 2, function returns 1 if the file ends
|
* and when flags is 2, function returns 1 if the file ends
|
||||||
* with line feed. If file doesn't exist returns -1. */
|
* with line feed. If file doesn't exist returns -1. */
|
||||||
native file_size(const file[], flag=0);
|
native file_size(const file[], flag=0);
|
||||||
|
|
||||||
|
#define SEEK_SET 0
|
||||||
|
#define SEEK_CUR 1
|
||||||
|
#define SEEK_END 2
|
||||||
|
|
||||||
|
// These are C style file access functions
|
||||||
|
// Code ported from Sanji's File module
|
||||||
|
|
||||||
|
//Open a file
|
||||||
|
native fopen(filename[],mode[]);
|
||||||
|
//Close a file
|
||||||
|
native fclose(file);
|
||||||
|
//Read a file for ret_size length
|
||||||
|
native fread(file,ret[],ret_size);
|
||||||
|
//Write a file
|
||||||
|
native fwrite(file,const str[],{Float,_}:...);
|
||||||
|
//Check if at the end of a file
|
||||||
|
native feof(file);
|
||||||
|
//Seek a file
|
||||||
|
native fseek(file,pos,type);
|
||||||
|
//Rewind a file (reset)
|
||||||
|
native rewind(file);
|
||||||
|
//Flush a file
|
||||||
|
native fflush(file);
|
||||||
|
//Scan a file by a format
|
||||||
|
native fscanf(file,const str[],{Float,_}:...);
|
||||||
|
//Returns the current file position pointer
|
||||||
|
native ftell(file);
|
||||||
|
//Return the size of a file
|
||||||
|
native filesize(const filename[],{Float,_}:...);
|
||||||
|
//Delete a file (delete_file macro)
|
||||||
|
native unlink(const filename[],{Float,_}:...);
|
||||||
|
|
||||||
|
//These are type specific file getting and writing commands:
|
||||||
|
//c=char, s=short, l=long, i=int, f=float
|
||||||
|
native fgetc(file); //read char (size 1)
|
||||||
|
native fgets(file); //read short (size 2)
|
||||||
|
native fgetl(file); //read long (size 4)
|
||||||
|
native fgeti(file); //read int (size 4)
|
||||||
|
native Float:fgetf(file); //read float (size 4)
|
||||||
|
|
||||||
|
native fputc(file,num); //write char (size 1)
|
||||||
|
native fputs(file,num); //write short (size 2)
|
||||||
|
native fputl(file,num); //write long (size 4)
|
||||||
|
native fputi(file,num); //write int (size 4)
|
||||||
|
native fputf(file,Float:num); //write float (size 4)
|
@ -71,8 +71,8 @@ native parse(const text[], ... );
|
|||||||
(A left side and right side of the string)
|
(A left side and right side of the string)
|
||||||
Example: to split text: "^"This is^" the best year",
|
Example: to split text: "^"This is^" the best year",
|
||||||
split(text, arg1, len1, arg2, len2)
|
split(text, arg1, len1, arg2, len2)
|
||||||
arg1="^"This is^"", arg2="the best year"
|
arg1="This is", arg2=the best year
|
||||||
This more useful than parse() because you can keep breaking
|
This is more useful than parse() because you can keep breaking
|
||||||
any number of arguments */
|
any number of arguments */
|
||||||
native strbreak(const text[], Left[], leftLen, Right[], rightLen);
|
native strbreak(const text[], Left[], leftLen, Right[], rightLen);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user