file
Contains routines for working with file stream.
List of constants
Name | Type | Description |
---|---|---|
sz_byte | int | 1 |
sz_word | int | 2 |
sz_int | int | 4 |
sz_long | int | 8 |
sz_single | int | 4 |
sz_double | int | 8 |
enc.cp866 | int | 866 |
enc.koi8r | int | 878 |
enc.koi8u | int | 1168 |
enc.unicode | int | 1200 |
enc.unicode_bigendian | int | 1201 |
enc.win1250 | int | 1250 |
enc.win1251 | int | 1251 |
enc.win1252 | int | 1252 |
enc.utf7 | int | 65000 |
enc.utf8 | int | 65001 |
Functions
1. file::copy
Copies bytes from one file stream to another.
Type definition
func(source: int, destination: int, size: int -> int)
List of arguments
Name | Type | Description |
---|---|---|
source | int | Handle of source stream |
destination | int | Handle of destignation stream |
size | int | Amount of bytes to be copied |
List of results
Name | Type | Description |
---|---|---|
- | int | How many bytes were actually copied |
2. file::getPos
Returns current position in file stream.
Type definition
func(handle: int -> int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
List of results
Name | Type | Description |
---|---|---|
- | int | Current position |
3. file::pack
Packs any value to file stream.
Type definition
func(handle: int, value: any)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
value | any | Value to be packed |
List of results
This function returns no results
4. file::readFloat
Reads float value from file stream.
Type definition
func(handle: int, size: int -> float)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
size | int | Precision, can be 4 or 8 bytes, see sz_float and sz_double constants |
List of results
Name | Type | Description |
---|---|---|
- | float | Returned value |
5. file::readInt
Reads integer value from file stream.
Type definition
func(handle: int, size: int, signed: bool -> int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
size | int | Size in bytes, can be 1, 2, 4 or 8, see sz_byte, sz_word, sz_int and sz_long constants |
signed | bool | If true value is threated as signed otherwise it is read as unsigned |
List of results
Name | Type | Description |
---|---|---|
- | int | Returned value |
6. file::readString
Reads string value from file stream.
Type definition
func(handle: int, size: int, encoding: int -> string)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
size | int | Maximun bytes amount to read |
encoding | int | Text codepage, see enc constant |
List of results
Name | Type | Description |
---|---|---|
- | string | Returned value |
7. file::setPos
Set position in file stream.
Type definition
func(handle: int, position: int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
postition | int | Position to be set from beginning of the file |
List of results
This function returns no results
8. file::size
Returns total file stream length.
Type definition
func(handle: int -> int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
List of results
Name | Type | Description |
---|---|---|
- | int | Length of file |
9. file::trunc
Truncates file on current position.
Type definition
func(handle: int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
List of results
This function returns no results
10. file::unpack
Unpacks any from file stream.
Type definition
func(handle: int -> any)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
List of results
Name | Type | Description |
---|---|---|
- | any | Unpacked value |
11. file::writeFloat
Writes float value to file stream.
Type definition
func(handle: int, value: float, size: int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
value | float | Value to be written |
size | int | Precision, can be 4 or 8 bytes, see sz_float and sz_double constants |
List of results
This function returns no results
12. file::writeInt
Writes integer value to file stream.
Type definition
func(handle: int, value: int, size: int, signed: bool)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
value | int | Value to be written |
size | int | Size in bytes, can be 1, 2, 4 or 8, see sz_byte, sz_word, sz_int and sz_long constants, other bytes are truncated |
signed | bool | If true value is written as signed otherwise it is written as unsigned |
List of results
This function returns no results
13. file::writeString
Writes string value to file stream.
Type definition
func(handle: int, value: string, encoding: int)
List of arguments
Name | Type | Description |
---|---|---|
handle | int | Handle of a stream |
value | string | Value to be written |
encoding | int | Text codepage, see enc constant |
List of results
This function returns no results