caca_file(3caca)
π caca_file β libcaca file IO π
ok so bestie, welcome to the caca_file page from the libcaca manual. this is the one that handles all your file reading and writing, and it's literally so much nicer than doing it by hand. let's get into it β¨
πΈ NAME πΈ
caca_file β libcaca file IO. that's it, that's the vibe π«Ά
β¨ SYNOPSIS β¨
π Topics
- libcaca importers/exporters from/to various
π§ 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 π¦
okay so these functions let you read and write files in a platform-independent way. no cap, that's the whole point β one API, every platform, zero drama π
π Function Documentation π
β __extern caca_file_t * caca_file_open (char const * path, const char * mode)
Creates a caca file handle for a file. and listen β if the file is zipped, it gets decompressed on the fly π§β¨ which is honestly iconic of it.
If an error occurs, NULL is returned and errno is set accordingly:
ENOSTSβ Function not implemented.EINVALβ File not found or permission denied.
Parameters
pathβ The file pathmodeβ 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)
Closes and destroys the resources associated with a caca file handle. say bye π
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)
Returns the file handle position, in bytes. like a little "where am i rn" for your file π
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_t size)
Reads data from a file handle and copies them into the given buffer. scoop it up π
Parameters
fpβ The file handleptrβ The destination buffersizeβ 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_t size)
Writes the contents of the given buffer to the file handle. putting your thoughts out into the world, main character energy π₯
Parameters
fpβ The file handleptrβ The source buffersizeβ The number of bytes to write
Returns
The number of bytes written
β __extern char * caca_file_gets (caca_file_t * fp, char * s, int size)
Reads one line of data from a file handle, up to one less than the given number of bytes. and a trailing zero is appended to the data β so remember that when you're counting π
Parameters
fpβ The file handlesβ The destination buffersizeβ 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)
Returns the end-of-file status of the file handle. vibe check: are we done here? π
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. (so don't come for me about the formatting, a robot wrote the original π)
and that's the whole page bestie, you ate that π«Άβ¨ mention it to your friends: this is Version 0.99.beta20, dated Wed May 13 2026 09:45:08 β mwah, see you in the next manpage ππΈ
π¦ where this page comes from
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 Β· WTFPL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms