1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/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.6">
8 <style type=
"text/css"><!--
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
13 H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
18 font-family: monaco, courier, monospace;
23 font-family: monaco, courier, monospace;
41 border: dotted thin #999999;
46 PRE.command EM, PRE.example EM {
47 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
51 font-family: monaco, courier, monospace;
62 border: solid thin #999999;
73 -moz-border-radius: 10px;
78 text-decoration: none;
81 A:link:hover, A:visited:hover, A:active {
82 text-decoration: underline;
89 TR.data, TD.data, TR.data TD {
92 border-bottom: solid 1pt #999999;
96 border-bottom: solid 1pt #999999;
103 border: solid thin #999999;
104 border-collapse: collapse;
120 border: solid thin #cccccc;
127 border-bottom: solid thin #999999;
136 caption-side: bottom;
160 border: thin solid black;
168 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
174 border-bottom: solid 2pt #000000;
177 DIV.indent, TABLE.indent {
185 border-collapse: collapse;
188 TABLE.indent TD, TABLE.indent TH {
193 border-collapse: collapse;
201 border-bottom: solid thin #cccccc;
206 vertical-align: bottom;
215 border-bottom: solid thin #eeeeee;
220 TABLE.list TR:nth-child(even) {
224 TABLE.list TR:nth-child(odd) {
243 font-family: monaco, courier, monospace;
247 border: solid thin #999999;
248 border-collapse: collapse;
253 DIV.summary TABLE TD, DIV.summary TABLE TH {
254 border: solid thin #999999;
260 DIV.summary TABLE THEAD TH {
264 /* API documentation styles... */
271 div.body h3, div.body h4, div.body h5 {
272 margin-bottom: 0.5em;
275 .class, .enumeration, .function, .struct, .typedef, .union {
276 border-bottom: solid thin #999999;
283 code, p.code, pre, ul.code li {
284 font-family: monaco, courier, monospace;
287 ul.code, ul.contents, ul.subcontents {
288 list-style-type: none;
298 ul.contents li ul.code, ul.contents li ul.subcontents {
311 margin-bottom: 0.5em;
314 /* This is just for the HTML files generated with the framedhelp target */
317 border: solid thin black;
326 div.contents ul.contents {
329 div.contents ul.subcontents li {
338 "$Id: api-filedir.header 8087 2008-10-27 21:37:05Z mike $"
340 File and Directory API header for the Common UNIX Printing System (CUPS).
342 Copyright 2008 by Apple Inc.
344 These coded instructions, statements, and computer programs are the
345 property of Apple Inc. and are protected by Federal copyright
346 law. Distribution and use rights are outlined in the file "LICENSE.txt"
347 which should have been included with this file. If this file is
348 file is missing or damaged, see the license at "http://www.cups.org/".
351 <div class='summary'
><table summary='General Information'
>
366 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
367 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
371 <h2 class=
"title">Contents
</h2>
372 <ul class=
"contents">
373 <ul class=
"subcontents">
374 <li><a href=
"#OVERVIEW">Overview
</a></li>
375 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
376 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
377 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
378 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
379 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
380 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
381 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
382 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
383 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
384 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
385 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
386 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file...">cupsFileGetConf
</a></li>
387 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
388 contain binary data.">cupsFileGetLine
</a></li>
389 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
390 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
391 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
392 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
393 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
394 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
395 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
396 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
397 <li><a href=
"#cupsFilePutConf" title=
"Write a configuration line.">cupsFilePutConf
</a></li>
398 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
399 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
400 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
401 file.">cupsFileRewind
</a></li>
402 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
403 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
404 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
405 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
406 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
407 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
408 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
410 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
411 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
412 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
413 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
415 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
416 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
419 "$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
421 File and directory API introduction for the Common UNIX Printing System (CUPS).
423 Copyright 2007-2008 by Apple Inc.
424 Copyright 1997-2005 by Easy Software Products, all rights reserved.
426 These coded instructions, statements, and computer programs are the
427 property of Apple Inc. and are protected by Federal copyright
428 law. Distribution and use rights are outlined in the file "LICENSE.txt"
429 which should have been included with this file. If this file is
430 file is missing or damaged, see the license at "http://www.cups.org/".
433 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
435 <p>The CUPS file and directory APIs provide portable interfaces
436 for manipulating files and listing files and directories. Unlike
437 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
438 allow you to open more than
256 files at any given time. They
439 also manage the platform-specific details of locking, large file
440 support, line endings (CR, LF, or CR LF), and reading and writing
441 files using Flate (
"gzip") compression. Finally, you can also
442 connect, read from, and write to network connections using the
443 <code>cupsFile
</code> functions.
</p>
445 <p>The
<code>cupsDir
</code> functions manage the platform-specific
446 details of directory access/listing and provide a convenient way
447 to get both a list of files and the information (permissions,
448 size, timestamp, etc.) for each of those files.
</p>
449 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
450 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
451 <p class=
"description">Close a directory.
</p>
453 void cupsDirClose (
<br>
454 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
456 <h4 class=
"parameters">Parameters
</h4>
459 <dd class=
"description">Directory pointer
</dd>
461 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
462 <p class=
"description">Open a directory.
</p>
464 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
465 const char *directory
<br>
467 <h4 class=
"parameters">Parameters
</h4>
470 <dd class=
"description">Directory name
</dd>
472 <h4 class=
"returnvalue">Return Value
</h4>
473 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
474 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
475 <p class=
"description">Read the next directory entry.
</p>
477 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
478 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
480 <h4 class=
"parameters">Parameters
</h4>
483 <dd class=
"description">Directory pointer
</dd>
485 <h4 class=
"returnvalue">Return Value
</h4>
486 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
487 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
488 <p class=
"description">Rewind to the start of the directory.
</p>
490 void cupsDirRewind (
<br>
491 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
493 <h4 class=
"parameters">Parameters
</h4>
496 <dd class=
"description">Directory pointer
</dd>
498 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
499 <p class=
"description">Close a CUPS file.
</p>
501 int cupsFileClose (
<br>
502 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
504 <h4 class=
"parameters">Parameters
</h4>
507 <dd class=
"description">CUPS file
</dd>
509 <h4 class=
"returnvalue">Return Value
</h4>
510 <p class=
"description">0 on success, -
1 on error
</p>
511 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
512 <p class=
"description">Return whether a file is compressed.
</p>
514 int cupsFileCompression (
<br>
515 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
517 <h4 class=
"parameters">Parameters
</h4>
520 <dd class=
"description">CUPS file
</dd>
522 <h4 class=
"returnvalue">Return Value
</h4>
523 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
524 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
525 <p class=
"description">Return the end-of-file status.
</p>
527 int cupsFileEOF (
<br>
528 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
530 <h4 class=
"parameters">Parameters
</h4>
533 <dd class=
"description">CUPS file
</dd>
535 <h4 class=
"returnvalue">Return Value
</h4>
536 <p class=
"description">1 on end of file,
0 otherwise
</p>
537 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
538 <p class=
"description">Find a file using the specified path.
</p>
540 const char *cupsFileFind (
<br>
541 const char *filename,
<br>
542 const char *path,
<br>
543 int executable,
<br>
544 char *buffer,
<br>
545 int bufsize
<br>
547 <h4 class=
"parameters">Parameters
</h4>
550 <dd class=
"description">File to find
</dd>
552 <dd class=
"description">Colon/semicolon-separated path
</dd>
554 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
556 <dd class=
"description">Filename buffer
</dd>
558 <dd class=
"description">Size of filename buffer
</dd>
560 <h4 class=
"returnvalue">Return Value
</h4>
561 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
562 <h4 class=
"discussion">Discussion
</h4>
563 <p class=
"discussion">This function allows the paths in the path string to be separated by
564 colons (UNIX standard) or semicolons (Windows standard) and stores the
565 result in the buffer supplied. If the file cannot be found in any of
566 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
567 matches the current directory.
570 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
571 <p class=
"description">Flush pending output.
</p>
573 int cupsFileFlush (
<br>
574 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
576 <h4 class=
"parameters">Parameters
</h4>
579 <dd class=
"description">CUPS file
</dd>
581 <h4 class=
"returnvalue">Return Value
</h4>
582 <p class=
"description">0 on success, -
1 on error
</p>
583 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
584 <p class=
"description">Get a single character from a file.
</p>
586 int cupsFileGetChar (
<br>
587 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
589 <h4 class=
"parameters">Parameters
</h4>
592 <dd class=
"description">CUPS file
</dd>
594 <h4 class=
"returnvalue">Return Value
</h4>
595 <p class=
"description">Character or -
1 on end of file
</p>
596 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
597 <p class=
"description">Get a line from a configuration file...
</p>
599 char *cupsFileGetConf (
<br>
600 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
601 char *buf,
<br>
602 size_t buflen,
<br>
603 char **value,
<br>
604 int *linenum
<br>
606 <h4 class=
"parameters">Parameters
</h4>
609 <dd class=
"description">CUPS file
</dd>
611 <dd class=
"description">String buffer
</dd>
613 <dd class=
"description">Size of string buffer
</dd>
615 <dd class=
"description">Pointer to value
</dd>
617 <dd class=
"description">Current line number
</dd>
619 <h4 class=
"returnvalue">Return Value
</h4>
620 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
621 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
622 <p class=
"description">Get a CR and/or LF-terminated line that may
623 contain binary data.
</p>
625 size_t cupsFileGetLine (
<br>
626 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
627 char *buf,
<br>
628 size_t buflen
<br>
630 <h4 class=
"parameters">Parameters
</h4>
633 <dd class=
"description">File to read from
</dd>
635 <dd class=
"description">Buffer
</dd>
637 <dd class=
"description">Size of buffer
</dd>
639 <h4 class=
"returnvalue">Return Value
</h4>
640 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
641 <h4 class=
"discussion">Discussion
</h4>
642 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
643 and LF are preserved, as is any binary data on the line. The buffer is
644 nul-terminated, however you should use the returned length to determine
645 the number of bytes on the line.
648 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
649 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
651 char *cupsFileGets (
<br>
652 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
653 char *buf,
<br>
654 size_t buflen
<br>
656 <h4 class=
"parameters">Parameters
</h4>
659 <dd class=
"description">CUPS file
</dd>
661 <dd class=
"description">String buffer
</dd>
663 <dd class=
"description">Size of string buffer
</dd>
665 <h4 class=
"returnvalue">Return Value
</h4>
666 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
667 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
668 <p class=
"description">Temporarily lock access to a file.
</p>
670 int cupsFileLock (
<br>
671 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
672 int block
<br>
674 <h4 class=
"parameters">Parameters
</h4>
677 <dd class=
"description">CUPS file
</dd>
679 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
681 <h4 class=
"returnvalue">Return Value
</h4>
682 <p class=
"description">0 on success, -
1 on error
</p>
683 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
684 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
686 int cupsFileNumber (
<br>
687 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
689 <h4 class=
"parameters">Parameters
</h4>
692 <dd class=
"description">CUPS file
</dd>
694 <h4 class=
"returnvalue">Return Value
</h4>
695 <p class=
"description">File descriptor
</p>
696 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
697 <p class=
"description">Open a CUPS file.
</p>
699 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
700 const char *filename,
<br>
701 const char *mode
<br>
703 <h4 class=
"parameters">Parameters
</h4>
706 <dd class=
"description">Name of file
</dd>
708 <dd class=
"description">Open mode
</dd>
710 <h4 class=
"returnvalue">Return Value
</h4>
711 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
712 <h4 class=
"discussion">Discussion
</h4>
713 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
714 existing file,
"a
" to append to an existing file or create a new file,
715 or
"s
" to open a socket connection.
<br>
717 When opening for writing (
"w
"), an optional number from
1 to
9 can be
718 supplied which enables Flate compression of the file. Compression is
719 not supported for the
"a
" (append) mode.
<br>
721 When opening a socket connection, the filename is a string of the form
722 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
723 connection as needed, generally preferring IPv6 connections when there is
727 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
728 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
730 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
731 int fd,
<br>
732 const char *mode
<br>
734 <h4 class=
"parameters">Parameters
</h4>
737 <dd class=
"description">File descriptor
</dd>
739 <dd class=
"description">Open mode
</dd>
741 <h4 class=
"returnvalue">Return Value
</h4>
742 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
743 <h4 class=
"discussion">Discussion
</h4>
744 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
745 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
747 When opening for writing (
"w
"), an optional number from
1 to
9 can be
748 supplied which enables Flate compression of the file. Compression is
749 not supported for the
"a
" (append) mode.
752 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
753 <p class=
"description">Peek at the next character from a file.
</p>
755 int cupsFilePeekChar (
<br>
756 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
758 <h4 class=
"parameters">Parameters
</h4>
761 <dd class=
"description">CUPS file
</dd>
763 <h4 class=
"returnvalue">Return Value
</h4>
764 <p class=
"description">Character or -
1 on end of file
</p>
765 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
766 <p class=
"description">Write a formatted string.
</p>
768 int cupsFilePrintf (
<br>
769 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
770 const char *format,
<br>
771 ...
<br>
773 <h4 class=
"parameters">Parameters
</h4>
776 <dd class=
"description">CUPS file
</dd>
778 <dd class=
"description">Printf-style format string
</dd>
780 <dd class=
"description">Additional args as necessary
</dd>
782 <h4 class=
"returnvalue">Return Value
</h4>
783 <p class=
"description">Number of bytes written or -
1 on error
</p>
784 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
785 <p class=
"description">Write a character.
</p>
787 int cupsFilePutChar (
<br>
788 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
789 int c
<br>
791 <h4 class=
"parameters">Parameters
</h4>
794 <dd class=
"description">CUPS file
</dd>
796 <dd class=
"description">Character to write
</dd>
798 <h4 class=
"returnvalue">Return Value
</h4>
799 <p class=
"description">0 on success, -
1 on error
</p>
800 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
801 <p class=
"description">Write a configuration line.
</p>
803 ssize_t cupsFilePutConf (
<br>
804 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
805 const char *directive,
<br>
806 const char *value
<br>
808 <h4 class=
"parameters">Parameters
</h4>
811 <dd class=
"description">CUPS file
</dd>
813 <dd class=
"description">Directive
</dd>
815 <dd class=
"description">Value
</dd>
817 <h4 class=
"returnvalue">Return Value
</h4>
818 <p class=
"description">Number of bytes written or -
1 on error
</p>
819 <h4 class=
"discussion">Discussion
</h4>
820 <p class=
"discussion">This function handles any comment escaping of the value.
823 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
824 <p class=
"description">Write a string.
</p>
826 int cupsFilePuts (
<br>
827 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
828 const char *s
<br>
830 <h4 class=
"parameters">Parameters
</h4>
833 <dd class=
"description">CUPS file
</dd>
835 <dd class=
"description">String to write
</dd>
837 <h4 class=
"returnvalue">Return Value
</h4>
838 <p class=
"description">Number of bytes written or -
1 on error
</p>
839 <h4 class=
"discussion">Discussion
</h4>
840 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
843 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
844 <p class=
"description">Read from a file.
</p>
846 ssize_t cupsFileRead (
<br>
847 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
848 char *buf,
<br>
849 size_t bytes
<br>
851 <h4 class=
"parameters">Parameters
</h4>
854 <dd class=
"description">CUPS file
</dd>
856 <dd class=
"description">Buffer
</dd>
858 <dd class=
"description">Number of bytes to read
</dd>
860 <h4 class=
"returnvalue">Return Value
</h4>
861 <p class=
"description">Number of bytes read or -
1 on error
</p>
862 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
863 <p class=
"description">Set the current file position to the beginning of the
866 off_t cupsFileRewind (
<br>
867 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
869 <h4 class=
"parameters">Parameters
</h4>
872 <dd class=
"description">CUPS file
</dd>
874 <h4 class=
"returnvalue">Return Value
</h4>
875 <p class=
"description">New file position or -
1 on error
</p>
876 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
877 <p class=
"description">Seek in a file.
</p>
879 off_t cupsFileSeek (
<br>
880 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
881 off_t pos
<br>
883 <h4 class=
"parameters">Parameters
</h4>
886 <dd class=
"description">CUPS file
</dd>
888 <dd class=
"description">Position in file
</dd>
890 <h4 class=
"returnvalue">Return Value
</h4>
891 <p class=
"description">New file position or -
1 on error
</p>
892 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
893 <p class=
"description">Return a CUPS file associated with stderr.
</p>
895 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
896 <h4 class=
"returnvalue">Return Value
</h4>
897 <p class=
"description">CUPS file
</p>
898 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
899 <p class=
"description">Return a CUPS file associated with stdin.
</p>
901 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
902 <h4 class=
"returnvalue">Return Value
</h4>
903 <p class=
"description">CUPS file
</p>
904 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
905 <p class=
"description">Return a CUPS file associated with stdout.
</p>
907 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
908 <h4 class=
"returnvalue">Return Value
</h4>
909 <p class=
"description">CUPS file
</p>
910 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
911 <p class=
"description">Return the current file position.
</p>
913 off_t cupsFileTell (
<br>
914 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
916 <h4 class=
"parameters">Parameters
</h4>
919 <dd class=
"description">CUPS file
</dd>
921 <h4 class=
"returnvalue">Return Value
</h4>
922 <p class=
"description">File position
</p>
923 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
924 <p class=
"description">Unlock access to a file.
</p>
926 int cupsFileUnlock (
<br>
927 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
929 <h4 class=
"parameters">Parameters
</h4>
932 <dd class=
"description">CUPS file
</dd>
934 <h4 class=
"returnvalue">Return Value
</h4>
935 <p class=
"description">0 on success, -
1 on error
</p>
936 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
937 <p class=
"description">Write to a file.
</p>
939 ssize_t cupsFileWrite (
<br>
940 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
941 const char *buf,
<br>
942 size_t bytes
<br>
944 <h4 class=
"parameters">Parameters
</h4>
947 <dd class=
"description">CUPS file
</dd>
949 <dd class=
"description">Buffer
</dd>
951 <dd class=
"description">Number of bytes to write
</dd>
953 <h4 class=
"returnvalue">Return Value
</h4>
954 <p class=
"description">Number of bytes written or -
1 on error
</p>
955 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
956 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
957 <p class=
"description">Directory entry type
</p>
959 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
961 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
962 <p class=
"description">Directory type
</p>
964 typedef struct _cups_dir_s cups_dir_t;
966 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
967 <p class=
"description">CUPS file type
</p>
969 typedef struct _cups_file_s cups_file_t;
971 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
972 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
973 <p class=
"description">Directory entry type
</p>
974 <p class=
"code">struct cups_dentry_s {
<br>
975 struct stat fileinfo;
<br>
976 char filename[
260];
<br>
978 <h4 class=
"members">Members
</h4>
981 <dd class=
"description">File information
</dd>
982 <dt>filename[
260]
</dt>
983 <dd class=
"description">File name
</dd>