This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Professional (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World Nodes
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Materials and Shaders
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::File Class

Header: #include <UnigineStreams.h>
Inherits from: Stream

This class allows you to write and read data into files. Files are stored locally (unlike Buffer which exists only in the memory).

See Also#

  • C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/File

File Class

Members


static FilePtr create ( ) #

Default constructor.

static FilePtr create ( const char * name, const char * mode ) #

Constructor.

Arguments

  • const char * name - File name.
  • const char * mode - Access mode (see open()).

int getc ( ) #

Reads the next character from the file.

Return value

Single character read from the opened file.

const char * getName ( ) #

Returns a name of the opened file.

Return value

File name.

size_t getSize ( ) #

Returns the size of the opened file in bytes.

Return value

File size in bytes.

int close ( ) #

Closes a file for any operation.

Return value

Returns 1 if the file is closed successfully; otherwise, 0.

int eof ( ) #

Tests for end-of-file on a file descriptor.

Return value

1 if it is the end of file; 0 otherwise.

int flush ( ) #

Forces to write of all buffered data to the file.

Return value

1 if the data is written successfully; otherwise, 0.

int open ( const char * name, const char * mode ) #

Opens a file with a given access mode: rb to open file for reading; wb to create a new file.
  • r - Open for reading only. The stream is positioned at the beginning of the file.
  • r+ - Open for reading and writing. The stream is positioned at the beginning of the file.
  • w - Truncate file to zero length or create file for writing. The stream is positioned at the beginning of the file.
  • w+ - Open for reading and writing. The file is created if it does not exist, otherwise it is truncated to zero length. The stream is positioned at the beginning of the file.
  • a - Open for appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file.
  • a+ - Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file.
  • b - For binary files. Otherwise, the file is deemed a text file, and Windows replaces \n with \n\r in text files.

Arguments

  • const char * name - Name of the file to open.
  • const char * mode - Access mode.

Return value

Returns 1 if the file is opened (or created, if the wb access mode is specified) successfully; otherwise, 0.

int seekCur ( size_t offset ) #

Sets an offset of the file position indicator relative to its current position.

Arguments

  • size_t offset - Offset of the file position indicator from the current position, in bytes.

Return value

Returns 1 if the file position indicator offset is set successfully; otherwise, 0.

int seekEnd ( size_t offset ) #

Sets an offset of the file position indicator relative to the end of the file.

Arguments

  • size_t offset - File position indicator offset from the end of the file in bytes.

Return value

Returns 1 if the file position indicator offset is set successfully; otherwise, 0.

int seekSet ( size_t offset ) #

Sets an offset of the file position indicator relatively to the start of the file.

Arguments

  • size_t offset - Offset of the file position indicator from the start of the file, in bytes.

Return value

1 if the offset has been set successfully; otherwise, 0.

size_t tell ( ) #

Returns the current offset of the file position indicator.

Return value

Offset in bytes from the beginning of the file.
Last update: 10.03.2022
Build: ()