Constant:
FOM_CREATE, FOM_OPENR, FOM_OPENW, FOM_OPENRW
FSM_SET, FSM_CUR, FSM_END
Rus: Данный модуль предоставляет возможность работы с файлами. Вам нужно объявить переменную как zglTFile. Большинство функций будут работать от данной переменной.
Используемые флаги:
- FOMCREATE - создание файла.
- FOM_OPENR - открыт только для чтения.
- FOM_OPENW - открыт для записи.
- FOMOPENRW - открыт для чтения и записи.
- FSMSET - отсчёт от начала файла.
- FSMCUR - отсчёт от текущей позиции файла.
- FSMEND - отсчёт с конца файла.
Внизу данной страницы так же указаны процедура и функция для открытия/закрытия архивов.
Eng: This module provides the ability to work with files. You need to declare the variable as zglTFile. Most functions will operate on this variable.
Flags used:
- FOMCREATE - file creation.
- FOM_OPENR - is read-only.
- FOM_OPENW - is open for writing.
- FOMOPENRW - is open for reading and writing.
- FSMSET - counting from the beginning of the file.
- FSMCUR - counting from the current file position.
- FSMEND - counting from the end of the file.
At the bottom of this page, the procedure and function for opening/closing archives are also indicated.
function file_Open(out FileHandle: zglTFile; const FileName: UTF8String; Mode: Byte{$IfDef MAC_COCOA}; log: Boolean = false{$EndIf}): Boolean;
Rus: открыть файл. Открывает файл с именем FileName. Mode - указывает флаг на то как будет открыт файл. Принимаемые значения Mode это: FOMCREATE, FOMOPENR, FOMOPENW или FOMOPENRW
Может открывать файлы из архивов, но только с флагом FOMOPENR.
Eng: open file. Opens a file named FileName. Mode - indicates the flag on how the file will be opened. Accepted Mode values are: FOMCREATE, FOMOPENR, FOMOPENW or FOMOPENRW
Can open files from archives, but only with the FOMOPENR flag.
function file_MakeDir(const Directory: UTF8String): Boolean;
Rus: создать директорию с заданным именем.
Eng: create a directory with the given name.
function file_Remove(const Name: UTF8String): Boolean;
Rus: удалить файл. Если в Name содержится указание каталогов, то файл будет удалён по полному пути указанному в Name.
Eng: delete a file. If Name contains directories, the file will be deleted using the full path specified in Name.
function file_Exists(const Name: UTF8String): Boolean;
Rus: существует файл или нет? Так же работает с архивами.
Eng: does the file exist or not? It also works with archives.
function file_Seek(FileHandle: zglTFile; Offset, Mode: Integer): LongWord;
Rus: установить позицию чтения/записи. Offset - смещение, Mode - флаг для указания откуда вести отсчёт. Используемые флаги: FSMSET, FSMCUR и FSMEND.
Eng: set read/write position. Offset - offset, Mode - flag to indicate where to count from. The flags used are FSMSET, FSMCUR and FSMEND.
function file_GetPos(FileHandle: zglTFile): LongWord;
Rus: вернуть позицию чтения/записи.
Eng: return read/write position.
function file_Read(FileHandle: zglTFile; var Buffer; Bytes: LongWord): LongWord;
Rus: чтение файла. Buffer - куда читаем данные. Bytes - сколько байт надо прочитать.
Возвращает количество считанных байт.
Так же работает с архивами.
Eng: reading a file. Buffer - where we read the data. Bytes - how many bytes need to be read.
Returns the number of bytes read.
It also works with archives.
function file_Write(FileHandle: zglTFile; const Buffer; Bytes: LongWord): LongWord;
Rus: сохранение файла. Buffer - откуда записываем данные. Bytes - сколько байт надо записать.
Возвращает количество записанных байт.
Eng: saving the file. Buffer - where we write data from. Bytes - how many bytes need to be written.
Returns the number of bytes written.
function file_GetSize(FileHandle: zglTFile): LongWord;
Rus: вернуть размер файла. Так же работает с архивами.
Eng: return file size. It also works with archives.
procedure file_Flush(FileHandle: zglTFile);
Rus:
Eng:
procedure file_Close(var FileHandle: zglTFile);
Rus: закрыть файл. Так же работает с архивами.
Eng: close the file. It also works with archives.
procedure file_Find(const Directory: UTF8String; out List: zglTFileList; FindDir: Boolean);
Rus: поиск файла. Так же работает с архивами.
Eng: file search. It also works with archives.
function file_GetName(const FileName: UTF8String): UTF8String;
Rus: вернуть имя файла из указанного пути.
Eng: return filename from specified path.
function file_GetExtension(const FileName: UTF8String): UTF8String;
Rus: вернуть расширение файла. Возможно указать путь полностью или частично.
Eng: return file extension. It is possible to specify the path in whole or in part.
function file_GetDirectory(const FileName: UTF8String): UTF8String;
Rus: вернуть имя директории. Вернёт путь до предшествующего каталога, если был указан конечный путь до определённого каталога.
Eng: return directory name. Returns the path to the previous directory if a final path to a specific directory was specified.
function file_LoadStringList(const FileName: UTF8String; out List: zglTStringList): Boolean;
Rus: загрузить и создать StringList из файла. Будьте аккуратны с UTF-8, могут быть ошибки.
Eng: load and create StringList from file. Be careful with UTF-8, there may be errors.
function file_OpenArchive(const FileName: UTF8String; const Password: UTF8String = ''): Boolean;
Rus: открыть архив.
Eng: open archive.
procedure file_CloseArchive;
Rus: закрыть архив.
Eng: close archive.