1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <!-- SECTION: Programming -->
5 <title>File and Directory APIs
</title>
6 <meta name='keywords' content='Programming'
>
7 <meta name='creator' content='Mini-XML v2.3'
>
8 <style type='text/css'
><!--
9 h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
10 tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }
11 pre { font-weight: bold; color: #7f0000; margin-left: 2em; }
12 span.info { background: #000000; border: solid thin #000000; color: #ffffff; font-size: 80%; font-style: italic; font-weight: bold; white-space: nowrap; }
13 h3 span.info { float: right; font-size: 100%; }
14 h1.title, h2.title, h3.title { border-bottom: solid 2px #000000; }
19 "$Id: api-filedir.html 177 2006-06-21 00:20:03Z jlovell $"
21 File and directory API introduction for the Common UNIX Printing System (CUPS).
23 Copyright 1997-2005 by Easy Software Products.
25 These coded instructions, statements, and computer programs are the
26 property of Easy Software Products and are protected by Federal
27 copyright law. Distribution and use rights are outlined in the file
28 "LICENSE.txt" which should have been included with this file. If this
29 file is missing or damaged please contact Easy Software Products
32 Attn: CUPS Licensing Information
33 Easy Software Products
34 44141 Airport View Drive, Suite 204
35 Hollywood, Maryland 20636 USA
38 EMail: cups-info@cups.org
39 WWW: http://www.cups.org
42 <h2 class='title'
>Introduction
</h2>
44 <p>The CUPS file and directory APIs provide portable interfaces
45 for manipulating files and listing files and directories. Unlike
46 stdio
<tt>FILE
</tt> streams, the
<tt>cupsFile
</tt> functions
47 allow you to open more than
256 files at any given time. They
48 also manage the platform-specific details of locking, large file
49 support, line endings (CR, LF, or CR LF), and reading and writing
50 files using Flate (
"gzip") compression. Finally, you can also
51 connect, read from, and write to network connections using the
52 <tt>cupsFile
</tt> functions.
</p>
54 <p>The
<tt>cupsDir
</tt> functions manage the platform-specific
55 details of directory access/listing and provide a convenient way
56 to get both a list of files and the information (permissions,
57 size, timestamp, etc.) for each of those files.
</p>
59 <p>The CUPS scheduler (
<tt>cupsd
</tt>),
<tt>mailto
</tt> notifier,
60 and many of the CUPS API functions use these functions for
61 everything except console (stdin, stdout, stderr) I/O.
</p>
63 <h2 class='title'
>General Usage
</h2>
65 <p>The
<var><cups/dir.h
></var> and
66 <var><cups/file.h
></var> header files must be included to
67 use the
<tt>cupsDir
</tt> and
<tt>cupsFile
</tt> functions,
70 <p>Programs using these functions must be linked to the CUPS
71 library:
<var>libcups.a
</var>,
<var>libcups.so
.2</var>,
72 <var>libcups
.2.dylib
</var>,
<var>libcups_s.a
</var>, or
73 <var>libcups2.lib
</var> depending on the platform. The following
74 command compiles
<var>myprogram.c
</var> using GCC and the CUPS
78 <kbd>gcc -o myprogram myprogram.c -lcups
</kbd>
81 <h2 class='title'
>Compatibility
</h2>
83 <p>All of these functions require CUPS
1.2 or higher.
</p>
84 <h2 class='title'
>Contents
</h2>
86 <li><a href='#FUNCTIONS'
>Functions
</a></li>
87 <li><a href='#STRUCTURES'
>Structures
</a></li>
88 <li><a href='#TYPES'
>Types
</a></li>
91 <h2 class='title'
><a name='FUNCTIONS'
>Functions
</a></h2>
93 <li><a href='#cupsDirClose'
><tt>cupsDirClose()
</tt></a> </li>
94 <li><a href='#cupsDirOpen'
><tt>cupsDirOpen()
</tt></a> </li>
95 <li><a href='#cupsDirRead'
><tt>cupsDirRead()
</tt></a> </li>
96 <li><a href='#cupsDirRewind'
><tt>cupsDirRewind()
</tt></a> </li>
97 <li><a href='#cupsFileClose'
><tt>cupsFileClose()
</tt></a> </li>
98 <li><a href='#cupsFileCompression'
><tt>cupsFileCompression()
</tt></a> </li>
99 <li><a href='#cupsFileEOF'
><tt>cupsFileEOF()
</tt></a> </li>
100 <li><a href='#cupsFileFind'
><tt>cupsFileFind()
</tt></a> </li>
101 <li><a href='#cupsFileFlush'
><tt>cupsFileFlush()
</tt></a> </li>
102 <li><a href='#cupsFileGetChar'
><tt>cupsFileGetChar()
</tt></a> </li>
103 <li><a href='#cupsFileGetConf'
><tt>cupsFileGetConf()
</tt></a> </li>
104 <li><a href='#cupsFileGetLine'
><tt>cupsFileGetLine()
</tt></a> </li>
105 <li><a href='#cupsFileGets'
><tt>cupsFileGets()
</tt></a> </li>
106 <li><a href='#cupsFileLock'
><tt>cupsFileLock()
</tt></a> </li>
107 <li><a href='#cupsFileNumber'
><tt>cupsFileNumber()
</tt></a> </li>
108 <li><a href='#cupsFileOpen'
><tt>cupsFileOpen()
</tt></a> </li>
109 <li><a href='#cupsFileOpenFd'
><tt>cupsFileOpenFd()
</tt></a> </li>
110 <li><a href='#cupsFilePeekChar'
><tt>cupsFilePeekChar()
</tt></a> </li>
111 <li><a href='#cupsFilePrintf'
><tt>cupsFilePrintf()
</tt></a> </li>
112 <li><a href='#cupsFilePutChar'
><tt>cupsFilePutChar()
</tt></a> </li>
113 <li><a href='#cupsFilePuts'
><tt>cupsFilePuts()
</tt></a> </li>
114 <li><a href='#cupsFileRead'
><tt>cupsFileRead()
</tt></a> </li>
115 <li><a href='#cupsFileRewind'
><tt>cupsFileRewind()
</tt></a> </li>
116 <li><a href='#cupsFileSeek'
><tt>cupsFileSeek()
</tt></a> </li>
117 <li><a href='#cupsFileStderr'
><tt>cupsFileStderr()
</tt></a> </li>
118 <li><a href='#cupsFileStdin'
><tt>cupsFileStdin()
</tt></a> </li>
119 <li><a href='#cupsFileStdout'
><tt>cupsFileStdout()
</tt></a> </li>
120 <li><a href='#cupsFileTell'
><tt>cupsFileTell()
</tt></a> </li>
121 <li><a href='#cupsFileUnlock'
><tt>cupsFileUnlock()
</tt></a> </li>
122 <li><a href='#cupsFileWrite'
><tt>cupsFileWrite()
</tt></a> </li>
125 <h3 class='title'
><a name='cupsDirClose'
>cupsDirClose()
</a></h3>
127 <p>Close a directory.
</p>
132 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
135 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
136 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
138 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
139 </tbody></table></div>
143 <h3 class='title'
><a name='cupsDirOpen'
>cupsDirOpen()
</a></h3>
145 <p>Open a directory.
</p>
148 <a href='#cups_dir_t'
>cups_dir_t
</a> *
150 const char * directory);
153 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
154 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
156 <tr><td><tt>directory
</tt></td><td>Directory name
</td></tr>
157 </tbody></table></div>
161 <h3 class='title'
><a name='cupsDirRead'
>cupsDirRead()
</a></h3>
163 <p>Read the next directory entry.
</p>
166 <a href='#cups_dentry_t'
>cups_dentry_t
</a> *
168 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
171 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
172 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
174 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
175 </tbody></table></div>
177 <p>Directory entry
</p>
179 <h3 class='title'
><a name='cupsDirRewind'
>cupsDirRewind()
</a></h3>
181 <p>Rewind to the start of the directory.
</p>
186 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
189 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
190 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
192 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
193 </tbody></table></div>
197 <h3 class='title'
><a name='cupsFileClose'
>cupsFileClose()
</a></h3>
199 <p>Close a CUPS file.
</p>
204 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
207 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
208 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
210 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
211 </tbody></table></div>
213 <p>0 on success, -
1 on error
</p>
215 <h3 class='title'
><a name='cupsFileCompression'
>cupsFileCompression()
</a></h3>
217 <p>Return whether a file is compressed.
</p>
222 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
225 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
226 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
228 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
229 </tbody></table></div>
231 <p>CUPS_FILE_NONE or CUPS_FILE_GZIP
</p>
233 <h3 class='title'
><a name='cupsFileEOF'
>cupsFileEOF()
</a></h3>
235 <p>Return the end-of-file status.
</p>
240 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
243 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
244 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
246 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
247 </tbody></table></div>
249 <p>1 on EOF,
0 otherwise
</p>
251 <h3 class='title'
><a name='cupsFileFind'
>cupsFileFind()
</a></h3>
253 <p>Find a file using the specified path.
255 This function allows the paths in the path string to be separated by
256 colons (UNIX standard) or semicolons (Windows standard) and stores the
257 result in the buffer supplied. If the file cannot be found in any of
258 the supplied paths, NULL is returned. A NULL path only matches the
259 current directory.
</p>
264 const char * filename,
271 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
272 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
274 <tr><td><tt>filename
</tt></td><td>File to find
</td></tr>
275 <tr><td><tt>path
</tt></td><td>Colon/semicolon-separated path
</td></tr>
276 <tr><td><tt>executable
</tt></td><td>1 = executable files,
0 = any file/dir
</td></tr>
277 <tr><td><tt>buffer
</tt></td><td>Filename buffer
</td></tr>
278 <tr><td><tt>bufsize
</tt></td><td>Size of filename buffer
</td></tr>
279 </tbody></table></div>
281 <p>Full path to file or NULL
</p>
283 <h3 class='title'
><a name='cupsFileFlush'
>cupsFileFlush()
</a></h3>
285 <p>Flush pending output.
</p>
290 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
293 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
294 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
296 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
297 </tbody></table></div>
299 <p>0 on success, -
1 on error
</p>
301 <h3 class='title'
><a name='cupsFileGetChar'
>cupsFileGetChar()
</a></h3>
303 <p>Get a single character from a file.
</p>
308 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
311 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
312 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
314 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
315 </tbody></table></div>
317 <p>Character or -
1 on EOF
</p>
319 <h3 class='title'
><a name='cupsFileGetConf'
>cupsFileGetConf()
</a></h3>
321 <p>Get a line from a configuration file...
</p>
326 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
333 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
334 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
336 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
337 <tr><td><tt>buf
</tt></td><td>String buffer
</td></tr>
338 <tr><td><tt>buflen
</tt></td><td>Size of string buffer
</td></tr>
339 <tr><td><tt>value
</tt></td><td>Pointer to value
</td></tr>
340 <tr><td><tt>linenum
</tt></td><td>Current line number
</td></tr>
341 </tbody></table></div>
343 <p>Line read or NULL on eof/error
</p>
345 <h3 class='title'
><a name='cupsFileGetLine'
>cupsFileGetLine()
</a></h3>
347 <p>Get a CR and/or LF-terminated line that may
350 This function differs from cupsFileGets() in that the trailing CR and LF
351 are preserved, as is any binary data on the line. The buffer is nul-
352 terminated, however you should use the returned length to determine
353 the number of bytes on the line.
</p>
358 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
363 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
364 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
366 <tr><td><tt>fp
</tt></td><td>File to read from
</td></tr>
367 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
368 <tr><td><tt>buflen
</tt></td><td>Size of buffer
</td></tr>
369 </tbody></table></div>
371 <p>Number of bytes on line or
0 on EOF
</p>
373 <h3 class='title'
><a name='cupsFileGets'
>cupsFileGets()
</a></h3>
375 <p>Get a CR and/or LF-terminated line.
</p>
380 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
385 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
386 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
388 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
389 <tr><td><tt>buf
</tt></td><td>String buffer
</td></tr>
390 <tr><td><tt>buflen
</tt></td><td>Size of string buffer
</td></tr>
391 </tbody></table></div>
393 <p>Line read or NULL on eof/error
</p>
395 <h3 class='title'
><a name='cupsFileLock'
>cupsFileLock()
</a></h3>
397 <p>Temporarily lock access to a file.
</p>
402 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
406 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
407 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
409 <tr><td><tt>fp
</tt></td><td>File to lock
</td></tr>
410 <tr><td><tt>block
</tt></td><td>1 to wait for the lock,
0 to fail right away
</td></tr>
411 </tbody></table></div>
413 <p>0 on success, -
1 on error
</p>
415 <h3 class='title'
><a name='cupsFileNumber'
>cupsFileNumber()
</a></h3>
417 <p>Return the file descriptor associated with a CUPS file.
</p>
422 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
425 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
426 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
428 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
429 </tbody></table></div>
431 <p>File descriptor
</p>
433 <h3 class='title'
><a name='cupsFileOpen'
>cupsFileOpen()
</a></h3>
435 <p>Open a CUPS file.
</p>
438 <a href='#cups_file_t'
>cups_file_t
</a> *
440 const char * filename,
444 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
445 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
447 <tr><td><tt>filename
</tt></td><td>Name of file
</td></tr>
448 <tr><td><tt>mode
</tt></td><td>Open mode
</td></tr>
449 </tbody></table></div>
451 <p>CUPS file or NULL
</p>
453 <h3 class='title'
><a name='cupsFileOpenFd'
>cupsFileOpenFd()
</a></h3>
455 <p>Open a CUPS file using a file descriptor.
</p>
458 <a href='#cups_file_t'
>cups_file_t
</a> *
464 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
465 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
467 <tr><td><tt>fd
</tt></td><td>File descriptor
</td></tr>
468 <tr><td><tt>mode
</tt></td><td>Open mode
</td></tr>
469 </tbody></table></div>
471 <p>CUPS file or NULL
</p>
473 <h3 class='title'
><a name='cupsFilePeekChar'
>cupsFilePeekChar()
</a></h3>
475 <p>Peek at the next character from a file.
</p>
480 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
483 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
484 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
486 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
487 </tbody></table></div>
489 <p>Character or -
1 on EOF
</p>
491 <h3 class='title'
><a name='cupsFilePrintf'
>cupsFilePrintf()
</a></h3>
493 <p>Write a formatted string.
</p>
498 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
503 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
504 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
506 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
507 <tr><td><tt>format
</tt></td><td>Printf-style format string
</td></tr>
508 <tr><td><tt>...
</tt></td><td>Additional args as necessary
</td></tr>
509 </tbody></table></div>
511 <p>Number of bytes written or -
1</p>
513 <h3 class='title'
><a name='cupsFilePutChar'
>cupsFilePutChar()
</a></h3>
515 <p>Write a character.
</p>
520 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
524 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
525 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
527 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
528 <tr><td><tt>c
</tt></td><td>Character to write
</td></tr>
529 </tbody></table></div>
531 <p>0 on success, -
1 on error
</p>
533 <h3 class='title'
><a name='cupsFilePuts'
>cupsFilePuts()
</a></h3>
535 <p>Write a string.
</p>
540 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
544 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
545 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
547 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
548 <tr><td><tt>s
</tt></td><td>String to write
</td></tr>
549 </tbody></table></div>
551 <p>Number of bytes written or -
1</p>
553 <h3 class='title'
><a name='cupsFileRead'
>cupsFileRead()
</a></h3>
555 <p>Read from a file.
</p>
558 <a href='#ssize_t'
>ssize_t
</a>
560 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
565 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
566 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
568 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
569 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
570 <tr><td><tt>bytes
</tt></td><td>Number of bytes to read
</td></tr>
571 </tbody></table></div>
573 <p>Number of bytes read or -
1</p>
575 <h3 class='title'
><a name='cupsFileRewind'
>cupsFileRewind()
</a></h3>
577 <p>Rewind a file.
</p>
582 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
585 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
586 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
588 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
589 </tbody></table></div>
591 <p>New file position or -
1</p>
593 <h3 class='title'
><a name='cupsFileSeek'
>cupsFileSeek()
</a></h3>
595 <p>Seek in a file.
</p>
600 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
604 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
605 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
607 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
608 <tr><td><tt>pos
</tt></td><td>Position in file
</td></tr>
609 </tbody></table></div>
611 <p>New file position or -
1</p>
613 <h3 class='title'
><a name='cupsFileStderr'
>cupsFileStderr()
</a></h3>
615 <p>Just reposition the current pointer, since we have the right
619 <a href='#cups_file_t'
>cups_file_t
</a> *
620 cupsFileStderr(void);
625 <p>Return a CUPS file associated with stderr.
</p>
627 <h3 class='title'
><a name='cupsFileStdin'
>cupsFileStdin()
</a></h3>
629 <p>Open file descriptor
2...
</p>
632 <a href='#cups_file_t'
>cups_file_t
</a> *
638 <p>Return a CUPS file associated with stdin.
</p>
640 <h3 class='title'
><a name='cupsFileStdout'
>cupsFileStdout()
</a></h3>
642 <p>Open file descriptor
0...
</p>
645 <a href='#cups_file_t'
>cups_file_t
</a> *
646 cupsFileStdout(void);
651 <p>Return a CUPS file associated with stdout.
</p>
653 <h3 class='title'
><a name='cupsFileTell'
>cupsFileTell()
</a></h3>
655 <p>Return the current file position.
</p>
660 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
663 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
664 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
666 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
667 </tbody></table></div>
671 <h3 class='title'
><a name='cupsFileUnlock'
>cupsFileUnlock()
</a></h3>
673 <p>Unlock access to a file.
</p>
678 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
681 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
682 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
684 <tr><td><tt>fp
</tt></td><td>File to lock
</td></tr>
685 </tbody></table></div>
687 <p>0 on success, -
1 on error
</p>
689 <h3 class='title'
><a name='cupsFileWrite'
>cupsFileWrite()
</a></h3>
691 <p>Write to a file.
</p>
694 <a href='#ssize_t'
>ssize_t
</a>
696 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
701 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0'
>
702 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
704 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
705 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
706 <tr><td><tt>bytes
</tt></td><td>Number of bytes to write
</td></tr>
707 </tbody></table></div>
709 <p>Number of bytes written
</p>
711 <h2 class='title'
><a name='STRUCTURES'
>Structures
</a></h2>
713 <li><a href='#cups_dentry_s'
><tt>cups_dentry_s
</tt></a> </li>
716 <h3 class='title'
><a name='cups_dentry_s'
>cups_dentry_s
</a></h3>
718 <p>Directory entry type
</p>
723 struct stat fileinfo;
728 <div class='table'
><table align='center' border='
1' width='
80%'
>
729 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
731 <tr><td><tt>fileinfo
</tt> </td><td>File information
</td></tr>
732 <tr><td><tt>filename[
260]
</tt> </td><td>File name
</td></tr>
733 </tbody></table></div>
735 <h2 class='title'
><a name='TYPES'
>Types
</a></h2>
737 <li><a href='#cups_dentry_t'
><tt>cups_dentry_t
</tt></a> </li>
738 <li><a href='#cups_dir_t'
><tt>cups_dir_t
</tt></a> </li>
739 <li><a href='#cups_file_t'
><tt>cups_file_t
</tt></a> </li>
742 <h3 class='title'
><a name='cups_dentry_t'
>cups_dentry_t
</a></h3>
744 <p>Directory entry type
</p>
747 typedef struct
<a href='#cups_dentry_s'
>cups_dentry_s
</a> cups_dentry_t;
750 <h3 class='title'
><a name='cups_dir_t'
>cups_dir_t
</a></h3>
752 <p>Directory type
</p>
755 typedef struct _cups_dir_s cups_dir_t;
758 <h3 class='title'
><a name='cups_file_t'
>cups_file_t
</a></h3>
760 <p>CUPS file type
</p>
763 typedef struct _cups_file_s cups_file_t;