File: gpgme.info, Node: File Based Data Buffers, Next: Callback Based Data Buffers, Prev: Memory Based Data Buffers, Up: Creating Data Buffers 6.1.2 File Based 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. -- Function: gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *DH, int FD) The function ‘gpgme_data_new_from_fd’ creates a new ‘gpgme_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. Note that GPGME assumes that the file descriptor is set to blocking mode. Errors during I/O operations, except for EINTR, are usually fatal for crypto operations. The function returns the error code ‘GPG_ERR_NO_ERROR’ if the data object was successfully created, and ‘GPG_ERR_ENOMEM’ if not enough memory is available. -- Function: gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *DH, FILE *STREAM) The function ‘gpgme_data_new_from_stream’ creates a new ‘gpgme_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. Note that GPGME assumes that the stream is in blocking mode. Errors during I/O operations, except for EINTR, are usually fatal for crypto operations. The function returns the error code ‘GPG_ERR_NO_ERROR’ if the data object was successfully created, and ‘GPG_ERR_ENOMEM’ if not enough memory is available. -- Function: gpgme_error_t gpgme_data_new_from_estream (gpgme_data_t *DH, gpgrt_stream_t STREAM) The function ‘gpgme_data_new_from_estream’ creates a new ‘gpgme_data_t’ object and uses the gpgrt 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. Note that GPGME assumes that the stream is in blocking mode. Errors during I/O operations, except for EINTR, are usually fatal for crypto operations. The function returns the error code ‘GPG_ERR_NO_ERROR’ if the data object was successfully created, and ‘GPG_ERR_ENOMEM’ if not enough memory is available.