Write file as binary

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO Windows,Linux


Write file as binary (refnumbinary-variable [,start-position]) Returns err-code


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 binary-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 byte (0 is the first byte in the file, 1 is the second byte, and so on), otherwise it begins at the current position (the first byte when the file is first opened).

It returns an error code (See Error Codes), or zero if no error occurs.


; write the binary class data of the window class 'MyWindow' to a file named
; 'binfile' in the root of the omnis tree, path returned in sys(115)
Calculate lPathname as con(sys(115),'binfile')
Create file (lPathname) Returns lErrCode
Open file (lPathname,lRefNum)
Calculate lBinfld as $clib.$windows.MyWindow.$classdata
Write file as binary (lRefNum,lBinfld) Returns lErrCode
Close file (lRefNum)