Next: Data Buffer Meta-Data, Up: Manipulating Data Buffers
The function
gpgme_data_read
reads up to length bytes from the data object with the handle dh into the space starting at buffer.If no error occurs, the actual amount read is returned. If the end of the data object is reached, the function returns 0.
In all other cases, the function returns -1 and sets errno.
The function
gpgme_data_write
writes up to size bytes starting from buffer into the data object with the handle dh at the current write position.The function returns the number of bytes actually written, or -1 if an error occurs. If an error occurs, errno is set.
The function
gpgme_data_seek
changes the current read/write position.The whence argument specifies how the offset should be interpreted. It must be one of the following symbolic constants:
SEEK_SET
- Specifies that offset is a count of characters from the beginning of the data object.
SEEK_CUR
- Specifies that offset is a count of characters from the current file position. This count may be positive or negative.
SEEK_END
- Specifies that offset is a count of characters from the end of the data object. A negative count specifies a position within the current extent of the data object; a positive count specifies a position past the current end. If you set the position past the current end, and actually write data, you will extend the data object with zeros up to that position.
If successful, the function returns the resulting file position, measured in bytes from the beginning of the data object. You can use this feature together with
SEEK_CUR
to read the current read/write position.If the function fails, -1 is returned and errno is set.
The following function is deprecated and should not be used. It will be removed in a future version of GPGME.