carb::crashreporter::writeFileBlob

Defined in carb/crashreporter/ICrashReporter.h

inline int64_t carb::crashreporter::writeFileBlob(FileHandle file, const void *buffer, size_t bytes)

Writes a blob of data to an open file descriptor in a platform independent manner.

Remark

This helper function is intended to be used with MetadataValueType::eFileBlob callbacks to write data to the open file descriptor. Note that this will only write binary data as-is. Any line ending or text conversions that may be necessary must be handled by the caller.

Parameters
  • fd[in] The open file descriptor to write to. This must be opened for writing.

  • buffer[in] The buffer of data to write to the file descriptor. At least bytes bytes of data must be safely accessible in this buffer.

  • bytes[in] The total number of bytes to write to the file.

Returns

The number of bytes successfully written to the file. This may be either 0 or a value smaller than bytes if there was a problem writing the entire buffer to the file (ie: disk full, etc). This will return -1 if an error occurs and no data could be written to the file.