| Command group | Flag affected | Reversible | Execute on client | Platform(s) |
| External commands | YES | NO | NO | Windows,Linux |
Note: The flag is set according to whether Omnis was able to make a call to this external command.
This command truncates a file. You specify the file reference number returned by Open file in refnum. The file is truncated at the current position of the file pointer or the specified end-position if given. The end-position parameter represents a byte position, unless you pass end-position-is-character as a non-zero value, in which case it represents an operating system character position (a byte position when running on Linux, or a 16-bit character position when running on Win32 or macOS).
It returns an error code (See Error Codes), or zero if no error occurs.
# write the contents of the character variable 'lCharVar' to a text file# named 'charfile.txt' in the root of the omnis tree and then truncate# the contents to 8 bytes
CalculatelPathnameascon(sys(115),'charfile.txt')
Create file(lPathname)ReturnslErrCode
Open file(lPathname,lRefNum)
CalculatelCharVaras'Truncate the contents of this file'
Write file as character(lRefNum,lCharVar)ReturnslErrCode
Truncate file(lRefNum,8)ReturnslErrCode
Close file(lRefNum)