ARSA Language
2.8
(Encryption, GPU and Web 3.0)
|
Go to the source code of this file.
Functions | |
int | fopen (const char *filename, const char *mode, bool cache=false, const char *filename_ex="") |
create a new file or to open an existing file. More... | |
void | fclose (int id, const char *mode="r") |
close a file More... | |
bool | feof (int id) |
is current position on file at the end More... | |
const char * | fgets (int id) |
read string on a file until found '\n' or eof More... | |
void | fprintf (int id, const char *str) |
write a string into a file More... | |
long | fsize (int id, const char *mode="r") |
get file size More... | |
long | fpos (int id, const char *mode="r") |
get current position on a file More... | |
void | fseek (int id, int finalPos, const char *mode="r") |
Changes position in file. More... | |
bool | fexist (const char *filename) |
is this file exist on drive More... | |
bool | fadd (const char *filename, const char *mode, bool cache=true, const char *filename_ex="", const char *archive_type="zip", const char *password="") |
bool | faddzip (const char *zipfilename, const const char *password="") |
bool | fremove (const char *filename) |
const char * | ftostring (const char *filename, const char *encode="utf8") |
Open file and allocate buffer to string, no drop file pointer. More... | |
bool | fdel (const char *filename) |
delete file from disk. More... | |
const char * | fread (int id, int len) |
read string start from current position until len count. More... | |
const char * | freadf (const char *filename, int seekpos, int len) |
read file start from seekpos until len count. More... | |
const char * | fgetsf (const char *filename, int line_nb) |
read string on a file until found '\n' and at line number count. More... | |
int | fsizef (const char *filename) |
get file size More... | |
const char * | ftointernalstorage (const char *filename) |
Example Read File
Example Write File
Definition in file file.h.
bool fadd | ( | const char * | filename, |
const char * | mode, | ||
bool | cache = true , |
||
const char * | filename_ex = "" , |
||
const char * | archive_type = "zip" , |
||
const char * | password = "" |
||
) |
Adds an archive to the file system.
After calling this, the Engine will also search and open files directly from this archive. This is useful for hiding data from the end user, speeding up file access and making it possible to access for example Quake3 .pk3 files, which are just renamed .zip files.
By default: supports ZIP, PAK, TAR, PNK, and directories as archives.
Supports AES-encrypted zip files, and the advanced compression techniques lzma and bzip2.
filename | Filename of the archive to add to the file system. |
mode | must be "r" |
cache | allocate to system memory before reading. |
filename_ex | is a new name of file, in case download from cloud e.g. google drive, dropbox |
archive_type | support archive type follows: (default is "zip") "zip" "gzip" "pak" "tar" |
password | archive password |
bool faddzip | ( | const char * | zipfilename, |
const const char * | password = "" |
||
) |
Adds ZIP archive to the file system.
After calling this, the Engine will also search and open files directly from this archive. This is useful for hiding data from the end user, speeding up file access.
By default: supports ZIP only!!!.
Supports AES-encrypted zip files, and the advanced compression techniques lzma and bzip2.
zipfilename | ZIP Filename of the archive to add to the file system. |
password | archive password |
void fclose | ( | int | id, |
const char * | mode = "r" |
||
) |
close a file
id | file id |
mode | default is "r", should be same mode to fopen() call |
bool fdel | ( | const char * | filename | ) |
delete file from disk.
filename | Filename of the file on disk. |
bool feof | ( | int | id | ) |
is current position on file at the end
id | file id |
bool fexist | ( | const char * | filename | ) |
is this file exist on drive
filename | is a string literal, which you will use to name your file |
const char* fgets | ( | int | id | ) |
read string on a file until found '\n' or eof
id | file id |
const char* fgetsf | ( | const char * | filename, |
int | line_nb | ||
) |
read string on a file until found '\n' and at line number count.
filename | is a string literal, which you will use to operation. |
line_nb | line number count, zero based. |
int fopen | ( | const char * | filename, |
const char * | mode, | ||
bool | cache = false , |
||
const char * | filename_ex = "" |
||
) |
create a new file or to open an existing file.
filename | is a string literal, which you will use to name your file |
mode | can have one of the following values: r : Opens an existing text file for reading purpose. w : Opens a text file for writing. If it does not exist, then a new file is created. Here your program will start writing content from the beginning of the file. wa : Opens a text file for writing in appending mode. If it does not exist, then a new file is created. Here your program will start appending content in the existing file content. |
cache | allocate to system memory before reading. |
filename_ex | is a new name of file, in case download from cloud e.g. google drive, dropbox |
long fpos | ( | int | id, |
const char * | mode = "r" |
||
) |
get current position on a file
id | file id |
mode | default is "r", should be same mode to fopen() call |
void fprintf | ( | int | id, |
const char * | str | ||
) |
write a string into a file
id | file id |
str | string that put on a file |
read string start from current position until len count.
id | file id |
len | size of read. |
read file start from seekpos until len count.
filename | is a string literal, which you will use to operation. |
seekpos | start position to read. |
len | size of read. |
bool fremove | ( | const char * | filename | ) |
Removes an archive from the file system.
This will close the archive and free any file handles, but will not close resources which have already been loaded and are now cached, for example textures and meshes.
filename | Filename of the archive to add to the file system. |
Changes position in file.
id | file id |
finalPos | Destination position in the file. |
mode | default is "r", should be same mode to fopen() call |
long fsize | ( | int | id, |
const char * | mode = "r" |
||
) |
get file size
id | file id |
mode | default is "r", should be same mode to fopen() call |
int fsizef | ( | const char * | filename | ) |
get file size
filename | is a string literal, which you will use to operation. |
const char* ftointernalstorage | ( | const char * | filename | ) |
copy file to internal storage, purpose for read or shrare file.
may this only support for mobile devices.
win32, psp, psvita, ps2 is not thing to do.
filename | is a string literal, which you will use to operation. |
const char* ftostring | ( | const char * | filename, |
const char * | encode = "utf8" |
||
) |
Open file and allocate buffer to string, no drop file pointer.
filename | is a string literal, which you will use to name your file |
encode | force encoding string to. default: utf8, (ascii for binary file) auto ascii utf8 utf16 utf32 wchar |