.TH "libcaca file IO" 3caca "Fri Apr 6 2012" "Version 0.99.beta18" "libcaca" \" -*- nroff -*- .ad l .nh .SH NAME libcaca file IO \- .SS "Functions" .in +1c .ti -1c .RI "__extern \fBcaca_file_t\fP * \fBcaca_file_open\fP (char const *, const char *)" .br .RI "\fIOpen a file for reading or writing\&. \fP" .ti -1c .RI "__extern int \fBcaca_file_close\fP (\fBcaca_file_t\fP *)" .br .RI "\fIClose a file handle\&. \fP" .ti -1c .RI "__extern uint64_t \fBcaca_file_tell\fP (\fBcaca_file_t\fP *)" .br .RI "\fIReturn the position in a file handle\&. \fP" .ti -1c .RI "__extern size_t \fBcaca_file_read\fP (\fBcaca_file_t\fP *, void *, size_t)" .br .RI "\fIRead data from a file handle\&. \fP" .ti -1c .RI "__extern size_t \fBcaca_file_write\fP (\fBcaca_file_t\fP *, const void *, size_t)" .br .RI "\fIWrite data to a file handle\&. \fP" .ti -1c .RI "__extern char * \fBcaca_file_gets\fP (\fBcaca_file_t\fP *, char *, int)" .br .RI "\fIRead a line from a file handle\&. \fP" .ti -1c .RI "__extern int \fBcaca_file_eof\fP (\fBcaca_file_t\fP *)" .br .RI "\fITell whether a file handle reached end of file\&. \fP" .in -1c .SH "Detailed Description" .PP These functions allow to read and write files in a platform-independent way\&. .SH "Function Documentation" .PP .SS "__extern \fBcaca_file_t\fP* \fBcaca_file_open\fP (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\&. .PP If an error occurs, NULL is returned and \fBerrno\fP is set accordingly: .IP "\(bu" 2 \fCENOSTS\fP Function not implemented\&. .IP "\(bu" 2 \fCEINVAL\fP File not found or permission denied\&. .PP .PP \fBParameters:\fP .RS 4 \fIpath\fP The file path .br \fImode\fP The file open mode .RE .PP \fBReturns:\fP .RS 4 A file handle to \fIpath\fP\&. .RE .PP .PP Referenced by caca_import_canvas_from_file()\&. .SS "__extern int \fBcaca_file_close\fP (\fBcaca_file_t\fP *fp)"Close and destroy the resources associated with a caca file handle\&. .PP This function is a wrapper for fclose() or, if available, gzclose()\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .RE .PP \fBReturns:\fP .RS 4 The return value of fclose() or gzclose()\&. .RE .PP .PP Referenced by caca_import_canvas_from_file()\&. .SS "__extern uint64_t \fBcaca_file_tell\fP (\fBcaca_file_t\fP *fp)"Return the file handle position, in bytes\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .RE .PP \fBReturns:\fP .RS 4 The current offset in the file handle\&. .RE .PP .SS "__extern size_t \fBcaca_file_read\fP (\fBcaca_file_t\fP *fp, void *ptr, size_tsize)"Read data from a file handle and copy them into the given buffer\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .br \fIptr\fP The destination buffer .br \fIsize\fP The number of bytes to read .RE .PP \fBReturns:\fP .RS 4 The number of bytes read .RE .PP .PP Referenced by caca_import_canvas_from_file()\&. .SS "__extern size_t \fBcaca_file_write\fP (\fBcaca_file_t\fP *fp, const void *ptr, size_tsize)"Write the contents of the given buffer to the file handle\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .br \fIptr\fP The source buffer .br \fIsize\fP The number of bytes to write .RE .PP \fBReturns:\fP .RS 4 The number of bytes written .RE .PP .SS "__extern char* \fBcaca_file_gets\fP (\fBcaca_file_t\fP *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\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .br \fIs\fP The destination buffer .br \fIsize\fP The maximum number of bytes to read .RE .PP \fBReturns:\fP .RS 4 The number of bytes read, including the trailing zero .RE .PP .SS "__extern int \fBcaca_file_eof\fP (\fBcaca_file_t\fP *fp)"Return the end-of-file status of the file handle\&. .PP This function is a wrapper for feof() or, if available, gzeof()\&. .PP \fBParameters:\fP .RS 4 \fIfp\fP The file handle .RE .PP \fBReturns:\fP .RS 4 1 if EOF was reached, 0 otherwise .RE .PP .PP Referenced by caca_import_canvas_from_file()\&. .SH "Author" .PP Generated automatically by Doxygen for libcaca from the source code\&.