Skip to main content
Skip table of contents

(v13) write_file write data to a file on the device

This page applies to Harlequin v13.1r0 and later; and to Harlequin Core but not Harlequin MultiRIP

  int32 write_file (
  uint8 *buff,
  int32 len );

The descriptor w ill be one returned by a previous open_file o n this device. The bytes to be written are stored in ascending addresses starting at buff . The number of bytes to write (len) can be any number greater than or equal to 0.

The routine should return the number of bytes successfully written, or -1 if an error occurred. If an error occurs, last_error should return DeviceIOError . When the returned number (of bytes actually written) is anything less than the number requested, it is also treated as a DeviceIOError .

Note that some implementations may need to close the file if the file is deleted (see delete_file ) and so an error may need to be returned even if there is no error in the underlying file system.

As an example, this behavior matches the usual behavior of UNIX file descriptors and so, except for the need not to block for any long period of time, both the file system and socket devices could just pass descriptor, buff, and len to the UNIX write system call. last_error would examine errno to determine the error to return.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.