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.4'
>
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.shtml 6649 2007-07-11 21:46:42Z mike $"
21 File and directory API introduction for the Common UNIX Printing System (CUPS).
23 Copyright 2007 by Apple Inc.
24 Copyright 1997-2005 by Easy Software Products, all rights reserved.
26 These coded instructions, statements, and computer programs are the
27 property of Apple Inc. and are protected by Federal copyright
28 law. Distribution and use rights are outlined in the file "LICENSE.txt"
29 which should have been included with this file. If this file is
30 file is missing or damaged, see the license at "http://www.cups.org/".
33 <h2 class='title'
>Introduction
</h2>
35 <p>The CUPS file and directory APIs provide portable interfaces
36 for manipulating files and listing files and directories. Unlike
37 stdio
<tt>FILE
</tt> streams, the
<tt>cupsFile
</tt> functions
38 allow you to open more than
256 files at any given time. They
39 also manage the platform-specific details of locking, large file
40 support, line endings (CR, LF, or CR LF), and reading and writing
41 files using Flate (
"gzip") compression. Finally, you can also
42 connect, read from, and write to network connections using the
43 <tt>cupsFile
</tt> functions.
</p>
45 <p>The
<tt>cupsDir
</tt> functions manage the platform-specific
46 details of directory access/listing and provide a convenient way
47 to get both a list of files and the information (permissions,
48 size, timestamp, etc.) for each of those files.
</p>
50 <p>The CUPS scheduler (
<tt>cupsd
</tt>),
<tt>mailto
</tt> notifier,
51 and many of the CUPS API functions use these functions for
52 everything except console (stdin, stdout, stderr) I/O.
</p>
54 <h2 class='title'
>General Usage
</h2>
56 <p>The
<var><cups/dir.h
></var> and
57 <var><cups/file.h
></var> header files must be included to
58 use the
<tt>cupsDir
</tt> and
<tt>cupsFile
</tt> functions,
61 <p>Programs using these functions must be linked to the CUPS
62 library:
<var>libcups.a
</var>,
<var>libcups.so
.2</var>,
63 <var>libcups
.2.dylib
</var>,
<var>libcups_s.a
</var>, or
64 <var>libcups2.lib
</var> depending on the platform. The following
65 command compiles
<var>myprogram.c
</var> using GCC and the CUPS
69 <kbd>gcc -o myprogram myprogram.c -lcups
</kbd>
72 <h2 class='title'
>Compatibility
</h2>
74 <p>All of these functions require CUPS
1.2 or higher.
</p>
75 <h2 class='title'
>Contents
</h2>
77 <li><a href='#FUNCTIONS'
>Functions
</a></li>
78 <li><a href='#STRUCTURES'
>Structures
</a></li>
79 <li><a href='#TYPES'
>Types
</a></li>
82 <h2 class='title'
><a name='FUNCTIONS'
>Functions
</a></h2>
84 <li><a href='#cupsDirClose'
><tt>cupsDirClose()
</tt></a> </li>
85 <li><a href='#cupsDirOpen'
><tt>cupsDirOpen()
</tt></a> </li>
86 <li><a href='#cupsDirRead'
><tt>cupsDirRead()
</tt></a> </li>
87 <li><a href='#cupsDirRewind'
><tt>cupsDirRewind()
</tt></a> </li>
88 <li><a href='#cupsFileClose'
><tt>cupsFileClose()
</tt></a> </li>
89 <li><a href='#cupsFileCompression'
><tt>cupsFileCompression()
</tt></a> </li>
90 <li><a href='#cupsFileEOF'
><tt>cupsFileEOF()
</tt></a> </li>
91 <li><a href='#cupsFileFind'
><tt>cupsFileFind()
</tt></a> </li>
92 <li><a href='#cupsFileFlush'
><tt>cupsFileFlush()
</tt></a> </li>
93 <li><a href='#cupsFileGetChar'
><tt>cupsFileGetChar()
</tt></a> </li>
94 <li><a href='#cupsFileGetConf'
><tt>cupsFileGetConf()
</tt></a> </li>
95 <li><a href='#cupsFileGetLine'
><tt>cupsFileGetLine()
</tt></a> </li>
96 <li><a href='#cupsFileGets'
><tt>cupsFileGets()
</tt></a> </li>
97 <li><a href='#cupsFileLock'
><tt>cupsFileLock()
</tt></a> </li>
98 <li><a href='#cupsFileNumber'
><tt>cupsFileNumber()
</tt></a> </li>
99 <li><a href='#cupsFileOpen'
><tt>cupsFileOpen()
</tt></a> </li>
100 <li><a href='#cupsFileOpenFd'
><tt>cupsFileOpenFd()
</tt></a> </li>
101 <li><a href='#cupsFilePeekChar'
><tt>cupsFilePeekChar()
</tt></a> </li>
102 <li><a href='#cupsFilePrintf'
><tt>cupsFilePrintf()
</tt></a> </li>
103 <li><a href='#cupsFilePutChar'
><tt>cupsFilePutChar()
</tt></a> </li>
104 <li><a href='#cupsFilePuts'
><tt>cupsFilePuts()
</tt></a> </li>
105 <li><a href='#cupsFileRead'
><tt>cupsFileRead()
</tt></a> </li>
106 <li><a href='#cupsFileRewind'
><tt>cupsFileRewind()
</tt></a> </li>
107 <li><a href='#cupsFileSeek'
><tt>cupsFileSeek()
</tt></a> </li>
108 <li><a href='#cupsFileStderr'
><tt>cupsFileStderr()
</tt></a> </li>
109 <li><a href='#cupsFileStdin'
><tt>cupsFileStdin()
</tt></a> </li>
110 <li><a href='#cupsFileStdout'
><tt>cupsFileStdout()
</tt></a> </li>
111 <li><a href='#cupsFileTell'
><tt>cupsFileTell()
</tt></a> </li>
112 <li><a href='#cupsFileUnlock'
><tt>cupsFileUnlock()
</tt></a> </li>
113 <li><a href='#cupsFileWrite'
><tt>cupsFileWrite()
</tt></a> </li>
116 <h3 class='title'
><a name='cupsDirClose'
>cupsDirClose()
</a></h3>
118 <p>Close a directory.
123 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
126 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
127 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
129 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
130 </tbody></table></div>
134 <h3 class='title'
><a name='cupsDirOpen'
>cupsDirOpen()
</a></h3>
139 <a href='#cups_dir_t'
>cups_dir_t
</a> *
<br>
141 const char * directory);
144 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
145 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
147 <tr><td><tt>directory
</tt></td><td>Directory name
</td></tr>
148 </tbody></table></div>
152 <h3 class='title'
><a name='cupsDirRead'
>cupsDirRead()
</a></h3>
154 <p>Read the next directory entry.
157 <a href='#cups_dentry_t'
>cups_dentry_t
</a> *
<br>
159 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
162 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
163 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
165 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
166 </tbody></table></div>
168 <p>Directory entry
</p>
170 <h3 class='title'
><a name='cupsDirRewind'
>cupsDirRewind()
</a></h3>
172 <p>Rewind to the start of the directory.
177 <a href='#cups_dir_t'
>cups_dir_t
</a> * dp);
180 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
181 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
183 <tr><td><tt>dp
</tt></td><td>Directory
</td></tr>
184 </tbody></table></div>
188 <h3 class='title'
><a name='cupsFileClose'
>cupsFileClose()
</a></h3>
190 <p>Close a CUPS file.
195 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
198 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
199 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
201 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
202 </tbody></table></div>
204 <p>0 on success, -
1 on error
</p>
206 <h3 class='title'
><a name='cupsFileCompression'
>cupsFileCompression()
</a></h3>
208 <p>Return whether a file is compressed.
213 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
216 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
217 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
219 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
220 </tbody></table></div>
222 <p>CUPS_FILE_NONE or CUPS_FILE_GZIP
</p>
224 <h3 class='title'
><a name='cupsFileEOF'
>cupsFileEOF()
</a></h3>
226 <p>Return the end-of-file status.
231 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
234 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
235 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
237 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
238 </tbody></table></div>
240 <p>1 on EOF,
0 otherwise
</p>
242 <h3 class='title'
><a name='cupsFileFind'
>cupsFileFind()
</a></h3>
244 <p>Find a file using the specified path.
245 <p>This function allows the paths in the path string to be separated by
246 colons (UNIX standard) or semicolons (Windows standard) and stores the
247 result in the buffer supplied. If the file cannot be found in any of
248 the supplied paths, NULL is returned. A NULL path only matches the
254 const char * filename,
261 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
262 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
264 <tr><td><tt>filename
</tt></td><td>File to find
</td></tr>
265 <tr><td><tt>path
</tt></td><td>Colon/semicolon-separated path
</td></tr>
266 <tr><td><tt>executable
</tt></td><td>1 = executable files,
0 = any file/dir
</td></tr>
267 <tr><td><tt>buffer
</tt></td><td>Filename buffer
</td></tr>
268 <tr><td><tt>bufsize
</tt></td><td>Size of filename buffer
</td></tr>
269 </tbody></table></div>
271 <p>Full path to file or NULL
</p>
273 <h3 class='title'
><a name='cupsFileFlush'
>cupsFileFlush()
</a></h3>
275 <p>Flush pending output.
280 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
283 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
284 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
286 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
287 </tbody></table></div>
289 <p>0 on success, -
1 on error
</p>
291 <h3 class='title'
><a name='cupsFileGetChar'
>cupsFileGetChar()
</a></h3>
293 <p>Get a single character from a file.
298 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
301 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
302 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
304 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
305 </tbody></table></div>
307 <p>Character or -
1 on EOF
</p>
309 <h3 class='title'
><a name='cupsFileGetConf'
>cupsFileGetConf()
</a></h3>
311 <p>Get a line from a configuration file...
316 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
323 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
324 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
326 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
327 <tr><td><tt>buf
</tt></td><td>String buffer
</td></tr>
328 <tr><td><tt>buflen
</tt></td><td>Size of string buffer
</td></tr>
329 <tr><td><tt>value
</tt></td><td>Pointer to value
</td></tr>
330 <tr><td><tt>linenum
</tt></td><td>Current line number
</td></tr>
331 </tbody></table></div>
333 <p>Line read or NULL on eof/error
</p>
335 <h3 class='title'
><a name='cupsFileGetLine'
>cupsFileGetLine()
</a></h3>
337 <p>Get a CR and/or LF-terminated line that may
339 <p>This function differs from cupsFileGets() in that the trailing CR and LF
340 are preserved, as is any binary data on the line. The buffer is nul-
341 terminated, however you should use the returned length to determine
342 the number of bytes on the line.
347 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
352 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
353 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
355 <tr><td><tt>fp
</tt></td><td>File to read from
</td></tr>
356 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
357 <tr><td><tt>buflen
</tt></td><td>Size of buffer
</td></tr>
358 </tbody></table></div>
360 <p>Number of bytes on line or
0 on EOF
</p>
362 <h3 class='title'
><a name='cupsFileGets'
>cupsFileGets()
</a></h3>
364 <p>Get a CR and/or LF-terminated line.
369 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
374 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
375 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
377 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
378 <tr><td><tt>buf
</tt></td><td>String buffer
</td></tr>
379 <tr><td><tt>buflen
</tt></td><td>Size of string buffer
</td></tr>
380 </tbody></table></div>
382 <p>Line read or NULL on eof/error
</p>
384 <h3 class='title'
><a name='cupsFileLock'
>cupsFileLock()
</a></h3>
386 <p>Temporarily lock access to a file.
391 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
395 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
396 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
398 <tr><td><tt>fp
</tt></td><td>File to lock
</td></tr>
399 <tr><td><tt>block
</tt></td><td>1 to wait for the lock,
0 to fail right away
</td></tr>
400 </tbody></table></div>
402 <p>0 on success, -
1 on error
</p>
404 <h3 class='title'
><a name='cupsFileNumber'
>cupsFileNumber()
</a></h3>
406 <p>Return the file descriptor associated with a CUPS file.
411 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
414 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
415 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
417 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
418 </tbody></table></div>
420 <p>File descriptor
</p>
422 <h3 class='title'
><a name='cupsFileOpen'
>cupsFileOpen()
</a></h3>
427 <a href='#cups_file_t'
>cups_file_t
</a> *
<br>
429 const char * filename,
433 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
434 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
436 <tr><td><tt>filename
</tt></td><td>Name of file
</td></tr>
437 <tr><td><tt>mode
</tt></td><td>Open mode
</td></tr>
438 </tbody></table></div>
440 <p>CUPS file or NULL
</p>
442 <h3 class='title'
><a name='cupsFileOpenFd'
>cupsFileOpenFd()
</a></h3>
444 <p>Open a CUPS file using a file descriptor.
447 <a href='#cups_file_t'
>cups_file_t
</a> *
<br>
453 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
454 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
456 <tr><td><tt>fd
</tt></td><td>File descriptor
</td></tr>
457 <tr><td><tt>mode
</tt></td><td>Open mode
</td></tr>
458 </tbody></table></div>
460 <p>CUPS file or NULL
</p>
462 <h3 class='title'
><a name='cupsFilePeekChar'
>cupsFilePeekChar()
</a></h3>
464 <p>Peek at the next character from a file.
469 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
472 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
473 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
475 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
476 </tbody></table></div>
478 <p>Character or -
1 on EOF
</p>
480 <h3 class='title'
><a name='cupsFilePrintf'
>cupsFilePrintf()
</a></h3>
482 <p>Write a formatted string.
487 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
492 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
493 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
495 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
496 <tr><td><tt>format
</tt></td><td>Printf-style format string
</td></tr>
497 <tr><td><tt>...
</tt></td><td>Additional args as necessary
</td></tr>
498 </tbody></table></div>
500 <p>Number of bytes written or -
1</p>
502 <h3 class='title'
><a name='cupsFilePutChar'
>cupsFilePutChar()
</a></h3>
504 <p>Write a character.
509 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
513 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
514 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
516 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
517 <tr><td><tt>c
</tt></td><td>Character to write
</td></tr>
518 </tbody></table></div>
520 <p>0 on success, -
1 on error
</p>
522 <h3 class='title'
><a name='cupsFilePuts'
>cupsFilePuts()
</a></h3>
529 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
533 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
534 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
536 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
537 <tr><td><tt>s
</tt></td><td>String to write
</td></tr>
538 </tbody></table></div>
540 <p>Number of bytes written or -
1</p>
542 <h3 class='title'
><a name='cupsFileRead'
>cupsFileRead()
</a></h3>
547 <a href='#ssize_t'
>ssize_t
</a><br>
549 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
554 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
555 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
557 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
558 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
559 <tr><td><tt>bytes
</tt></td><td>Number of bytes to read
</td></tr>
560 </tbody></table></div>
562 <p>Number of bytes read or -
1</p>
564 <h3 class='title'
><a name='cupsFileRewind'
>cupsFileRewind()
</a></h3>
571 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
574 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
575 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
577 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
578 </tbody></table></div>
580 <p>New file position or -
1</p>
582 <h3 class='title'
><a name='cupsFileSeek'
>cupsFileSeek()
</a></h3>
589 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
593 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
594 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
596 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
597 <tr><td><tt>pos
</tt></td><td>Position in file
</td></tr>
598 </tbody></table></div>
600 <p>New file position or -
1</p>
602 <h3 class='title'
><a name='cupsFileStderr'
>cupsFileStderr()
</a></h3>
604 <p>Just reposition the current pointer, since we have the right
608 <a href='#cups_file_t'
>cups_file_t
</a> *
<br>
609 cupsFileStderr(void);
614 <p>Return a CUPS file associated with stderr.
</p>
616 <h3 class='title'
><a name='cupsFileStdin'
>cupsFileStdin()
</a></h3>
618 <p>Open file descriptor
2...
621 <a href='#cups_file_t'
>cups_file_t
</a> *
<br>
627 <p>Return a CUPS file associated with stdin.
</p>
629 <h3 class='title'
><a name='cupsFileStdout'
>cupsFileStdout()
</a></h3>
631 <p>Open file descriptor
0...
634 <a href='#cups_file_t'
>cups_file_t
</a> *
<br>
635 cupsFileStdout(void);
640 <p>Return a CUPS file associated with stdout.
</p>
642 <h3 class='title'
><a name='cupsFileTell'
>cupsFileTell()
</a></h3>
644 <p>Return the current file position.
649 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
652 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
653 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
655 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
656 </tbody></table></div>
660 <h3 class='title'
><a name='cupsFileUnlock'
>cupsFileUnlock()
</a></h3>
662 <p>Unlock access to a file.
667 <a href='#cups_file_t'
>cups_file_t
</a> * fp);
670 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
671 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
673 <tr><td><tt>fp
</tt></td><td>File to lock
</td></tr>
674 </tbody></table></div>
676 <p>0 on success, -
1 on error
</p>
678 <h3 class='title'
><a name='cupsFileWrite'
>cupsFileWrite()
</a></h3>
683 <a href='#ssize_t'
>ssize_t
</a><br>
685 <a href='#cups_file_t'
>cups_file_t
</a> * fp,
690 <div class='table'
><table align='center' border='
1' width='
80%' cellpadding='
5' cellspacing='
0' summary='Arguments'
>
691 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
693 <tr><td><tt>fp
</tt></td><td>CUPS file
</td></tr>
694 <tr><td><tt>buf
</tt></td><td>Buffer
</td></tr>
695 <tr><td><tt>bytes
</tt></td><td>Number of bytes to write
</td></tr>
696 </tbody></table></div>
698 <p>Number of bytes written
</p>
700 <h2 class='title'
><a name='STRUCTURES'
>Structures
</a></h2>
702 <li><a href='#cups_dentry_s'
><tt>cups_dentry_s
</tt></a> </li>
705 <h3 class='title'
><a name='cups_dentry_s'
>cups_dentry_s
</a></h3>
707 <p>Directory entry type
710 struct cups_dentry_s
<br>
712 struct stat fileinfo;
<br>
713 char filename[
260];
<br>
716 <div class='table'
><table align='center' border='
1' width='
80%' summary='Members'
>
717 <thead><tr><th>Name
</th><th>Description
</th></tr></thead>
719 <tr><td><tt>fileinfo
</tt> </td><td>File information
721 <tr><td><tt>filename[
260]
</tt> </td><td>File name
723 </tbody></table></div>
725 <h2 class='title'
><a name='TYPES'
>Types
</a></h2>
727 <li><a href='#cups_dentry_t'
><tt>cups_dentry_t
</tt></a> </li>
728 <li><a href='#cups_dir_t'
><tt>cups_dir_t
</tt></a> </li>
729 <li><a href='#cups_file_t'
><tt>cups_file_t
</tt></a> </li>
732 <h3 class='title'
><a name='cups_dentry_t'
>cups_dentry_t
</a></h3>
734 <p>Directory entry type
737 typedef struct
<a href='#cups_dentry_s'
>cups_dentry_s
</a> cups_dentry_t;
740 <h3 class='title'
><a name='cups_dir_t'
>cups_dir_t
</a></h3>
745 typedef struct _cups_dir_s cups_dir_t;
748 <h3 class='title'
><a name='cups_file_t'
>cups_file_t
</a></h3>
753 typedef struct _cups_file_s cups_file_t;