|
proto int | Read (out void data, int length) |
| Read raw data.
|
|
proto int | ReadLine (out string data) |
| Get line from file, every next call of this function returns next line.
|
|
proto int | ReadArray (out notnull Managed dataArray, int elementLength, int numElements) |
| Read raw data.
|
|
proto int | Write (void data, int length=-1) |
| Write raw data.
|
|
proto void | WriteLine (string data) |
| Write to file and add newline (CARRIAGE RETURN + LINE FEED).
|
|
proto int | WriteArray (out notnull Managed dataArray, int elementLength=4, int numElements=-1) |
| Write raw data.
|
|
proto void | Seek (int pos) |
| Set current position in file.
|
|
proto int | GetPos () |
| Get current position in file.
|
|
proto int | GetLength () |
| Get file size.
|
|
proto void | Close () |
| Close the File.
|
|
proto bool | IsOpen () |
|
proto bool | IsEOF () |
| Indicate that the End-of-File has been reached.
|
|
proto external ref Managed | Clone () |
| Return shallow copy of object, or null if it is not allowed (not public constructor)
|
|
if (fileW)
{
int valInt = 4679;
float valFloat = 87.79;
string valStr = "Hello";
}
if (fileR)
{
int valInt;
float valFloat;
string valStr;
}
if (textFileW)
{
for (int i = 0; i < 10; i++)
{
}
}
if (textFileR)
{
string line;
{
}
}
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
FileMode
Mode for opening file. See FileSystem::Open.
Definition: FileMode.c:14
Definition: FileHandle.c:69
proto void Close()
Close the File.
proto int ReadLine(out string data)
Get line from file, every next call of this function returns next line.
proto int Read(out void data, int length)
Read raw data.
proto void WriteLine(string data)
Write to file and add newline (CARRIAGE RETURN + LINE FEED).
proto int Write(void data, int length=-1)
Write raw data.
static proto ref FileHandle OpenFile(string name, FileMode mode)
Opens a File.
◆ Close()
proto void FileHandle.Close |
( |
| ) |
|
◆ GetLength()
proto int FileHandle.GetLength |
( |
| ) |
|
Get file size.
- Returns
- file size in bytes
◆ GetPos()
proto int FileHandle.GetPos |
( |
| ) |
|
Get current position in file.
- Returns
- offset from the file beginning
◆ IsEOF()
proto bool FileHandle.IsEOF |
( |
| ) |
|
Indicate that the End-of-File has been reached.
◆ IsOpen()
proto bool FileHandle.IsOpen |
( |
| ) |
|
◆ Read()
proto int FileHandle.Read |
( |
out void |
data, |
|
|
int |
length |
|
) |
| |
Read raw data.
- Parameters
-
data | supported types: int, float, string |
length | number of bytes to read. For int type is clamped [0,4]. For float its not used (always 4). For string it's not limited. |
- Returns
- the total number of bytes successfully read.
◆ ReadArray()
proto int FileHandle.ReadArray |
( |
out notnull Managed |
dataArray, |
|
|
int |
elementLength, |
|
|
int |
numElements |
|
) |
| |
Read raw data.
- Parameters
-
dataArray | supported types: array<int>, array<float> (array content will be overwritten) |
elementLength | number of bytes from each array element to read (e.g. for reading array of bytes use 1, for shorts use 2, for int-s use 4). For int type its clamped [0,4] For float its not used (always 4). |
numElements | number of array elements to read. |
- Returns
- the total number of bytes successfully read.
◆ ReadLine()
proto int FileHandle.ReadLine |
( |
out string |
data | ) |
|
Get line from file, every next call of this function returns next line.
- Returns
- Count of characters or -1 if there is nothing to read
◆ Seek()
proto void FileHandle.Seek |
( |
int |
pos | ) |
|
Set current position in file.
- Parameters
-
pos | offset from the file beginning |
◆ Write()
proto int FileHandle.Write |
( |
void |
data, |
|
|
int |
length = -1 |
|
) |
| |
Write raw data.
- Parameters
-
data | supported types: int, float, string |
length | number of bytes to write. For int type its clamped [0,4] For float its not used. For string its clamped [0, size of string]. If -1 value is used, the whole content of data is written. |
- Returns
- the total number of bytes successfully written.
◆ WriteArray()
proto int FileHandle.WriteArray |
( |
out notnull Managed |
dataArray, |
|
|
int |
elementLength = 4 , |
|
|
int |
numElements = -1 |
|
) |
| |
Write raw data.
- Parameters
-
dataArray | supported types: array<int>, array<float> |
elementLength | number of bytes from each array element to write. For int type its clamped [0,4] For float its not used (always 4). |
numElements | number of array elements to write. If -1 value is used, all elements from array are written. |
- Returns
- the total number of bytes successfully written.
◆ WriteLine()
proto void FileHandle.WriteLine |
( |
string |
data | ) |
|
Write to file and add newline (CARRIAGE RETURN + LINE FEED).
- Parameters
-
The documentation for this interface was generated from the following file:
- Core/generated/System/FileHandle.c