Next: Callback Based Data Buffers, Previous: Memory Based Data Buffers, Up: Creating Data Buffers
File based data objects operate directly on file descriptors or streams. Only a small amount of data is stored in core at any time, so the size of the data objects is not limited by GPGME.
The function
gpgme_data_new_from_fd
creates a newgpgme_data_t
object and uses the file descriptor fd to read from (if used as an input data object) and write to (if used as an output data object).When using the data object as an input buffer, the function might read a bit more from the file descriptor than is actually needed by the crypto engine in the desired operation because of internal buffering.
The function returns the error code
GPG_ERR_NO_ERROR
if the data object was successfully created, andGPG_ERR_ENOMEM
if not enough memory is available.
The function
gpgme_data_new_from_stream
creates a newgpgme_data_t
object and uses the I/O stream stream to read from (if used as an input data object) and write to (if used as an output data object).When using the data object as an input buffer, the function might read a bit more from the stream than is actually needed by the crypto engine in the desired operation because of internal buffering.
The function returns the error code
GPG_ERR_NO_ERROR
if the data object was successfully created, andGPG_ERR_ENOMEM
if not enough memory is available.