File
Provides file operations
Example
# static file utilities
if(System.IO.File->Exists("data.txt")) {
content := System.IO.FileReader->ReadFile("data.txt");
System.IO.FileWriter->WriteFile("copy.txt", content);
};Operations
- New
- AccessedTime
- Copy
- CreateTime
- Delete
- Exists
- Flush
- GetFullName
- GetName
- GetTempName
- Group
- IsEoF
- IsOpen
- IsReadOnly
- IsReadWrite
- IsWriteOnly
- ModifiedTime
- Owner
- Rename
- Rewind
- Seek
- Size
AccessedTime # function
Returns the time in which the file was accessed
function : AccessedTime(n:System.String) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Date | accessed date |
AccessedTime #
Returns the time in which the file was accessed
method : public : AccessedTime() ~ DateReturn
| Type | Description |
|---|---|
| Date | accessed date |
AccessedTime # function
Returns the time in which the file was accessed
function : AccessedTime(n:System.String, gmt:Bool) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
| gmt | Bool | true if GMT |
Return
| Type | Description |
|---|---|
| Date | accessed date |
AccessedTime #
Returns the time in which the file was accessed
method : public : AccessedTime(gmt:Bool) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| gmt | Bool | true if GMT |
Return
| Type | Description |
|---|---|
| Date | accessed date |
Copy # function
Copies a file
function : Copy(s:System.String, d:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| s | String | source filename |
| d | String | destination filename |
Return
| Type | Description |
|---|---|
| Bool | true if file was copied |
Example
System.IO.File->Copy("source.txt", "backup.txt");Copy # function
Copies a file
function : Copy(s:System.String, d:System.String, o:Bool) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| s | String | source filename |
| d | String | destination filename |
| o | Bool | true to overwrite existing file, false otherwise |
Return
| Type | Description |
|---|---|
| Bool | true if file was copied |
CreateTime # function
Returns the time in which the file was created
function : CreateTime(n:System.String) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Date | create date |
CreateTime #
Returns the time in which the file was created
method : public : CreateTime() ~ DateReturn
| Type | Description |
|---|---|
| Date | create date |
CreateTime # function
Returns the time in which the file was created
function : CreateTime(n:System.String, gmt:Bool) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
| gmt | Bool | true if GMT |
Return
| Type | Description |
|---|---|
| Date | create date |
CreateTime #
Returns the time in which the file was created
method : public : CreateTime(gmt:Bool) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| gmt | Bool | true if GMT |
Return
| Type | Description |
|---|---|
| Date | create date |
Delete # function
Deletes the file
function : Delete(n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Bool | true if file was deleted, false otherwise |
Example
if(System.IO.File->Delete("temp.txt")) {
"Deleted"->PrintLine();
};Delete #
Deletes a file
method : public : Delete() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if file was deleted |
Exists # function
Checks if a file exists
function : Exists(n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Bool | true if file exists |
Example
if(System.IO.File->Exists("config.json")) {
"File found"->PrintLine();
};Exists #
Checks if a file exists
method : public : Exists() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if file exists |
GetFullName # function
Gets the full path name for file
function : GetFullName(n:System.String) ~ System.StringParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| String | full path name, Nil otherwise |
GetFullName #
Gets the full path name for file
method : public : GetFullName() ~ System.StringReturn
| Type | Description |
|---|---|
| String | full path name, Nil otherwise |
GetTempName # function
Gets a temporary filename
function : GetTempName() ~ System.StringReturn
| Type | Description |
|---|---|
| String | temporary filename |
Group # function
Gets the file group name
function : Group(n:System.String) ~ System.StringParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| String | file group name |
Group #
Gets the file group name
method : public : Group() ~ System.StringReturn
| Type | Description |
|---|---|
| String | file group name |
IsEoF #
Check if seek pointer is at the end-of-file
method : public : IsEoF() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if at the end-of-file, false otherwise |
IsOpen #
Checks of the file is open
method : public : IsOpen() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if the file was opened, false otherwise |
IsReadOnly # function
Checks if a file can be read
function : IsReadOnly(n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Bool | true if file can be read |
IsReadOnly #
Checks if a file can be read
method : public : IsReadOnly() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if file can be read |
IsReadWrite # function
Checks if a file can be read-only
function : IsReadWrite(n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Bool | true if file can be read-only |
IsReadWrite #
Checks if a file can be read-only
method : public : IsReadWrite() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if file can be read-only |
IsWriteOnly # function
Checks if a file can be written
function : IsWriteOnly(n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Bool | true if file can be written |
IsWriteOnly #
Checks if a file can be written
method : public : IsWriteOnly() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if file can be written |
ModifiedTime # function
Returns the time in which the file was modified
function : ModifiedTime(n:System.String) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| Date | modified date |
ModifiedTime # function
Returns the time in which the file was modified
function : ModifiedTime(n:System.String, gmt:Bool) ~ DateParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
| gmt | Bool | true if GMT |
Return
| Type | Description |
|---|---|
| Date | modified date |
New # constructor
Default constructor
New(name:System.String)Parameters
| Name | Type | Description |
|---|---|---|
| name | String | filename |
Owner # function
Gets the file owner name
function : Owner(n:System.String) ~ System.StringParameters
| Name | Type | Description |
|---|---|---|
| n | String | filename |
Return
| Type | Description |
|---|---|
| String | file owner name |
Owner #
Gets the file owner name
method : public : Owner() ~ System.StringReturn
| Type | Description |
|---|---|
| String | file owner name |
Rename # function
Renames a file
function : Rename(o:System.String, n:System.String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| o | String | original filename |
| n | String | new filename |
Return
| Type | Description |
|---|---|
| Bool | true if file was renamed |
Example
System.IO.File->Rename("old.txt", "new.txt");Seek #
Seeks to a point in the file
method : public : Seek(p:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| p | Int | seek offset |
Return
| Type | Description |
|---|---|
| Bool | true if operation was successful, false otherwise |