Function transmission_sys::tr_sys_file_read_line
source · pub unsafe extern "C" fn tr_sys_file_read_line(
handle: tr_sys_file_t,
buffer: *mut c_char,
buffer_size: usize,
error: *mut *mut tr_error
) -> u8
Expand description
@brief Portability wrapper for fgets ()
, removing EOL internally.
Special care should be taken when reading from one of standard input streams (@ref tr_std_sys_file_t) since no UTF-8 conversion is currently being made.
Reading from other streams (files, pipes) also leaves data untouched, so it should already be in UTF-8 encoding, or whichever else you expect.
@param[in] handle Valid file descriptor.
@param[out] buffer Buffer to store read zero-terminated string to.
@param[in] buffer_size Buffer size in bytes, taking ‘\0’ character into
account.
@param[out] error Pointer to error object. Optional, pass NULL
if you
are not interested in error details.
@return True
on success, false
otherwise (with error
set accordingly).
Note that false
will also be returned in case of end of file; if
you need to distinguish the two, check if error
is NULL
afterwards.