Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

caca_file_read(3caca) [debian man page]

libcaca file IO(3caca)						      libcaca						    libcaca file IO(3caca)

NAME
libcaca file IO - Functions __extern caca_file_t * caca_file_open (char const *, const char *) Open a file for reading or writing. __extern int caca_file_close (caca_file_t *) Close a file handle. __extern uint64_t caca_file_tell (caca_file_t *) Return the position in a file handle. __extern size_t caca_file_read (caca_file_t *, void *, size_t) Read data from a file handle. __extern size_t caca_file_write (caca_file_t *, const void *, size_t) Write data to a file handle. __extern char * caca_file_gets (caca_file_t *, char *, int) Read a line from a file handle. __extern int caca_file_eof (caca_file_t *) Tell whether a file handle reached end of file. Detailed Description These functions allow to read and write files in a platform-independent way. Function Documentation __extern caca_file_t* caca_file_open (char const *path, const char *mode) Create a caca file handle for a file. If the file is zipped, it is decompressed on the fly. If an error occurs, NULL is returned and errno is set accordingly: o ENOSTS Function not implemented. o EINVAL File not found or permission denied. Parameters: path The file path mode The file open mode Returns: A file handle to path. Referenced by caca_import_canvas_from_file(). __extern int caca_file_close (caca_file_t *fp) Close and destroy the resources associated with a caca file handle. This function is a wrapper for fclose() or, if available, gzclose(). Parameters: fp The file handle Returns: The return value of fclose() or gzclose(). Referenced by caca_import_canvas_from_file(). __extern uint64_t caca_file_tell (caca_file_t *fp) Return the file handle position, in bytes. Parameters: fp The file handle Returns: The current offset in the file handle. __extern size_t caca_file_read (caca_file_t *fp, void *ptr, size_tsize) Read data from a file handle and copy them into the given buffer. Parameters: fp The file handle ptr The destination buffer size The number of bytes to read Returns: The number of bytes read Referenced by caca_import_canvas_from_file(). __extern size_t caca_file_write (caca_file_t *fp, const void *ptr, size_tsize) Write the contents of the given buffer to the file handle. Parameters: fp The file handle ptr The source buffer size The number of bytes to write Returns: The number of bytes written __extern char* caca_file_gets (caca_file_t *fp, char *s, intsize) Read one line of data from a file handle, up to one less than the given number of bytes. A trailing zero is appended to the data. Parameters: fp The file handle s The destination buffer size The maximum number of bytes to read Returns: The number of bytes read, including the trailing zero __extern int caca_file_eof (caca_file_t *fp) Return the end-of-file status of the file handle. This function is a wrapper for feof() or, if available, gzeof(). Parameters: fp The file handle Returns: 1 if EOF was reached, 0 otherwise Referenced by caca_import_canvas_from_file(). Author Generated automatically by Doxygen for libcaca from the source code. Version 0.99.beta18 Fri Apr 6 2012 libcaca file IO(3caca)

Check Out this Related Man Page

libcaca character set conversions(3caca)			      libcaca				  libcaca character set conversions(3caca)

NAME
libcaca character set conversions - Functions __extern uint32_t caca_utf8_to_utf32 (char const *, size_t *) Convert a UTF-8 character to UTF-32. __extern size_t caca_utf32_to_utf8 (char *, uint32_t) Convert a UTF-32 character to UTF-8. __extern uint8_t caca_utf32_to_cp437 (uint32_t) Convert a UTF-32 character to CP437. __extern uint32_t caca_cp437_to_utf32 (uint8_t) Convert a CP437 character to UTF-32. __extern char caca_utf32_to_ascii (uint32_t) Convert a UTF-32 character to ASCII. __extern int caca_utf32_is_fullwidth (uint32_t) Tell whether a UTF-32 character is fullwidth. Detailed Description These functions perform conversions between usual character sets. Function Documentation __extern uint32_t caca_utf8_to_utf32 (char const *s, size_t *bytes) Convert a UTF-8 character read from a string and return its value in the UTF-32 character set. If the second argument is not null, the total number of read bytes is written in it. If a null byte was reached before the expected end of the UTF-8 sequence, this function returns zero and the number of read bytes is set to zero. This function never fails, but its behaviour with illegal UTF-8 sequences is undefined. Parameters: s A string containing the UTF-8 character. bytes A pointer to a size_t to store the number of bytes in the character, or NULL. Returns: The corresponding UTF-32 character, or zero if the character is incomplete. Referenced by caca_put_str(). __extern size_t caca_utf32_to_utf8 (char *buf, uint32_tch) Convert a UTF-32 character read from a string and write its value in the UTF-8 character set into the given buffer. This function never fails, but its behaviour with illegal UTF-32 characters is undefined. Parameters: buf A pointer to a character buffer where the UTF-8 sequence will be written. ch The UTF-32 character. Returns: The number of bytes written. __extern uint8_t caca_utf32_to_cp437 (uint32_tch) Convert a UTF-32 character read from a string and return its value in the CP437 character set, or '?' if the character has no equivalent. This function never fails. Parameters: ch The UTF-32 character. Returns: The corresponding CP437 character, or '?' if not representable. __extern uint32_t caca_cp437_to_utf32 (uint8_tch) Convert a CP437 character read from a string and return its value in the UTF-32 character set, or zero if the character is a CP437 control character. This function never fails. Parameters: ch The CP437 character. Returns: The corresponding UTF-32 character, or zero if not representable. __extern char caca_utf32_to_ascii (uint32_tch) Convert a UTF-32 character into an ASCII character. When no equivalent exists, a graphically close equivalent is sought. This function never fails, but its behaviour with illegal UTF-32 characters is undefined. Parameters: ch The UTF-32 character. Returns: The corresponding ASCII character, or a graphically close equivalent if found, or '?' if not representable. __extern int caca_utf32_is_fullwidth (uint32_tch) Check whether the given UTF-32 character should be printed at twice the normal width (fullwidth characters). If the character is unknown or if its status cannot be decided, it is treated as a standard-width character. This function never fails. Parameters: ch The UTF-32 character. Returns: 1 if the character is fullwidth, 0 otherwise. Referenced by caca_put_char(), and caca_put_str(). Author Generated automatically by Doxygen for libcaca from the source code. Version 0.99.beta18 Fri Apr 6 2012 libcaca character set conversions(3caca)
Man Page