| 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 writes the contents of the specified character-variable to a file. You specify the file reference number returned by Open file in refnum.
If you specify the start-position, writing begins at that absolute character position (0 is the first character in the file, 1 is the second character, and so on), otherwise it begins at the current position (the first character when the file is first opened).
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
CalculatelPathnameascon(sys(115),'charfile.txt')
Create file(lPathname)ReturnslErrCode
Open file(lPathname,lRefNum)
CalculatelCharVaras'The contents of this file was written using the command Write file as character'Write file as character(lRefNum,lCharVar)ReturnslErrCode
Close file(lRefNum)