Official web site : http://www.scolring.org/.
Plateform : Windows XP or +, GNU / Linux with glib > 2.x
Scol : 4.0 or +
Open, close, read and write to the temporary file
No specific way.
FileTemp is a new type
It describes a new temporary file.
_FILEOpenTemp is a function to open a new temporary file.
This function opens a unique temporary file in binary read/write mode. The file will be automatically deleted
when it is closed or the program terminates.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [Chn] FileTemp | |||
| - | Chn | channel | a channel in which the connection will be created |
| FileTemp | - | - | New scol object, or nil if error (open the log to see the error returned) |
Open a new temporary file, save to any datas and read it.
typeof ftmp = FileTemp;; typeof s = S;; fun main()= _showconsole; set ftmp = _FILEOpenTemp _channel; _FILEWriteTmp ftmp "Scol a good language !"; _FILESeekTemp ftmp 5 0; _FILEWriteTmp ftmp "is"; _FILESeekTemp ftmp 0 0; set s = _FILEReadTemp ftmp 25; _fooS strcat "Temp : " s; _FILECloseTemp ftmp; 0;;
Destroy a temporary file Scol object. The physical file will be automatically deleted.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp] I | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| I | - | - | 0, or nil if error |
Read to a number of bytes of a temporary file from the curent position of its cursor.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp I] S | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| - | I | bytes | the number of bytes to read. |
| S | - | - | the string read or nil if error |
Return the size of a temporary file.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp] S | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| I | - | - | its size or nil if error |
Return the current cursor's position of a temporary file.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp] S | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| I | - | - | its position or nil if error |
Move the cursor to a temporary file.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp I I] S | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| - | I | bytes | the number of bytes to move. |
| - | I | from | This flag can take 3 values :
|
| I | - | - | 0 or nil if error |
Write a string to a temporary file from the current position of its cursor.
If needed, move the cursor (_FILESeekTemp) before to write it.
| Return | Type | Name | Description |
|---|---|---|---|
| fun [FileTemp S] I | |||
| - | FileTemp | file | any temporary file Scol object already created. |
| - | S | bytes | the string to write. |
| I | - | - | 0 or nil if error |