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_fdcreates a newgpgme_data_tobject 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_ERRORif the data object was successfully created, andGPG_ERR_ENOMEMif not enough memory is available.
The function
gpgme_data_new_from_streamcreates a newgpgme_data_tobject 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_ERRORif the data object was successfully created, andGPG_ERR_ENOMEMif not enough memory is available.