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 {
177 border-bottom: solid 2pt #000000;
180 DIV.indent, TABLE.indent {
188 border-collapse: collapse;
191 TABLE.indent TD, TABLE.indent TH {
196 border-collapse: collapse;
204 border-bottom: solid thin #cccccc;
209 vertical-align: bottom;
218 border-bottom: solid thin #eeeeee;
223 TABLE.list TR:nth-child(even) {
227 TABLE.list TR:nth-child(odd) {
246 font-family: monaco, courier, monospace;
250 border: solid thin #999999;
251 border-collapse: collapse;
256 DIV.summary TABLE TD, DIV.summary TABLE TH {
257 border: solid thin #999999;
263 DIV.summary TABLE THEAD TH {
267 /* API documentation styles... */
274 div.body h3, div.body h4, div.body h5 {
275 margin-bottom: 0.5em;
278 .class, .enumeration, .function, .struct, .typedef, .union {
279 border-bottom: solid thin #999999;
286 code, p.code, pre, ul.code li {
287 font-family: monaco, courier, monospace;
290 ul.code, ul.contents, ul.subcontents {
291 list-style-type: none;
301 ul.contents li ul.code, ul.contents li ul.subcontents {
314 margin-bottom: 0.5em;
317 /* This is just for the HTML files generated with the framedhelp target */
320 border: solid thin black;
329 div.contents ul.contents {
332 div.contents ul.subcontents li {
343 File and Directory API header for the Common UNIX Printing System (CUPS).
345 Copyright 2008-2009 by Apple Inc.
347 These coded instructions, statements, and computer programs are the
348 property of Apple Inc. and are protected by Federal copyright
349 law. Distribution and use rights are outlined in the file "LICENSE.txt"
350 which should have been included with this file. If this file is
351 file is missing or damaged, see the license at "http://www.cups.org/".
354 <h1 class='title'
>File and Directory APIs
</h1>
356 <div class='summary'
><table summary='General Information'
>
371 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
372 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
376 <h2 class=
"title">Contents
</h2>
377 <ul class=
"contents">
378 <ul class=
"subcontents">
379 <li><a href=
"#OVERVIEW">Overview
</a></li>
380 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
381 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
382 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
383 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
384 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
385 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
386 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
387 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
388 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
389 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
390 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
391 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file...">cupsFileGetConf
</a></li>
392 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
393 contain binary data.">cupsFileGetLine
</a></li>
394 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
395 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
396 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
397 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
398 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
399 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
400 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
401 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
402 <li><a href=
"#cupsFilePutConf" title=
"Write a configuration line.">cupsFilePutConf
</a></li>
403 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
404 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
405 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
406 file.">cupsFileRewind
</a></li>
407 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
408 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
409 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
410 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
411 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
412 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
413 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
415 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
416 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
417 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
418 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
420 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
421 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
426 File and directory API introduction for the Common UNIX Printing System (CUPS).
428 Copyright 2007-2008 by Apple Inc.
429 Copyright 1997-2005 by Easy Software Products, all rights reserved.
431 These coded instructions, statements, and computer programs are the
432 property of Apple Inc. and are protected by Federal copyright
433 law. Distribution and use rights are outlined in the file "LICENSE.txt"
434 which should have been included with this file. If this file is
435 file is missing or damaged, see the license at "http://www.cups.org/".
438 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
440 <p>The CUPS file and directory APIs provide portable interfaces
441 for manipulating files and listing files and directories. Unlike
442 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
443 allow you to open more than
256 files at any given time. They
444 also manage the platform-specific details of locking, large file
445 support, line endings (CR, LF, or CR LF), and reading and writing
446 files using Flate (
"gzip") compression. Finally, you can also
447 connect, read from, and write to network connections using the
448 <code>cupsFile
</code> functions.
</p>
450 <p>The
<code>cupsDir
</code> functions manage the platform-specific
451 details of directory access/listing and provide a convenient way
452 to get both a list of files and the information (permissions,
453 size, timestamp, etc.) for each of those files.
</p>
454 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
455 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
456 <p class=
"description">Close a directory.
</p>
458 void cupsDirClose (
<br>
459 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
461 <h4 class=
"parameters">Parameters
</h4>
464 <dd class=
"description">Directory pointer
</dd>
466 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
467 <p class=
"description">Open a directory.
</p>
469 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
470 const char *directory
<br>
472 <h4 class=
"parameters">Parameters
</h4>
475 <dd class=
"description">Directory name
</dd>
477 <h4 class=
"returnvalue">Return Value
</h4>
478 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
479 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
480 <p class=
"description">Read the next directory entry.
</p>
482 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
483 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
485 <h4 class=
"parameters">Parameters
</h4>
488 <dd class=
"description">Directory pointer
</dd>
490 <h4 class=
"returnvalue">Return Value
</h4>
491 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
492 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
493 <p class=
"description">Rewind to the start of the directory.
</p>
495 void cupsDirRewind (
<br>
496 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
498 <h4 class=
"parameters">Parameters
</h4>
501 <dd class=
"description">Directory pointer
</dd>
503 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
504 <p class=
"description">Close a CUPS file.
</p>
506 int cupsFileClose (
<br>
507 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
509 <h4 class=
"parameters">Parameters
</h4>
512 <dd class=
"description">CUPS file
</dd>
514 <h4 class=
"returnvalue">Return Value
</h4>
515 <p class=
"description">0 on success, -
1 on error
</p>
516 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
517 <p class=
"description">Return whether a file is compressed.
</p>
519 int cupsFileCompression (
<br>
520 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
522 <h4 class=
"parameters">Parameters
</h4>
525 <dd class=
"description">CUPS file
</dd>
527 <h4 class=
"returnvalue">Return Value
</h4>
528 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
529 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
530 <p class=
"description">Return the end-of-file status.
</p>
532 int cupsFileEOF (
<br>
533 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
535 <h4 class=
"parameters">Parameters
</h4>
538 <dd class=
"description">CUPS file
</dd>
540 <h4 class=
"returnvalue">Return Value
</h4>
541 <p class=
"description">1 on end of file,
0 otherwise
</p>
542 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
543 <p class=
"description">Find a file using the specified path.
</p>
545 const char *cupsFileFind (
<br>
546 const char *filename,
<br>
547 const char *path,
<br>
548 int executable,
<br>
549 char *buffer,
<br>
550 int bufsize
<br>
552 <h4 class=
"parameters">Parameters
</h4>
555 <dd class=
"description">File to find
</dd>
557 <dd class=
"description">Colon/semicolon-separated path
</dd>
559 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
561 <dd class=
"description">Filename buffer
</dd>
563 <dd class=
"description">Size of filename buffer
</dd>
565 <h4 class=
"returnvalue">Return Value
</h4>
566 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
567 <h4 class=
"discussion">Discussion
</h4>
568 <p class=
"discussion">This function allows the paths in the path string to be separated by
569 colons (UNIX standard) or semicolons (Windows standard) and stores the
570 result in the buffer supplied. If the file cannot be found in any of
571 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
572 matches the current directory.
575 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
576 <p class=
"description">Flush pending output.
</p>
578 int cupsFileFlush (
<br>
579 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
581 <h4 class=
"parameters">Parameters
</h4>
584 <dd class=
"description">CUPS file
</dd>
586 <h4 class=
"returnvalue">Return Value
</h4>
587 <p class=
"description">0 on success, -
1 on error
</p>
588 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
589 <p class=
"description">Get a single character from a file.
</p>
591 int cupsFileGetChar (
<br>
592 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
594 <h4 class=
"parameters">Parameters
</h4>
597 <dd class=
"description">CUPS file
</dd>
599 <h4 class=
"returnvalue">Return Value
</h4>
600 <p class=
"description">Character or -
1 on end of file
</p>
601 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
602 <p class=
"description">Get a line from a configuration file...
</p>
604 char *cupsFileGetConf (
<br>
605 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
606 char *buf,
<br>
607 size_t buflen,
<br>
608 char **value,
<br>
609 int *linenum
<br>
611 <h4 class=
"parameters">Parameters
</h4>
614 <dd class=
"description">CUPS file
</dd>
616 <dd class=
"description">String buffer
</dd>
618 <dd class=
"description">Size of string buffer
</dd>
620 <dd class=
"description">Pointer to value
</dd>
622 <dd class=
"description">Current line number
</dd>
624 <h4 class=
"returnvalue">Return Value
</h4>
625 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
626 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
627 <p class=
"description">Get a CR and/or LF-terminated line that may
628 contain binary data.
</p>
630 size_t cupsFileGetLine (
<br>
631 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
632 char *buf,
<br>
633 size_t buflen
<br>
635 <h4 class=
"parameters">Parameters
</h4>
638 <dd class=
"description">File to read from
</dd>
640 <dd class=
"description">Buffer
</dd>
642 <dd class=
"description">Size of buffer
</dd>
644 <h4 class=
"returnvalue">Return Value
</h4>
645 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
646 <h4 class=
"discussion">Discussion
</h4>
647 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
648 and LF are preserved, as is any binary data on the line. The buffer is
649 nul-terminated, however you should use the returned length to determine
650 the number of bytes on the line.
653 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
654 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
656 char *cupsFileGets (
<br>
657 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
658 char *buf,
<br>
659 size_t buflen
<br>
661 <h4 class=
"parameters">Parameters
</h4>
664 <dd class=
"description">CUPS file
</dd>
666 <dd class=
"description">String buffer
</dd>
668 <dd class=
"description">Size of string buffer
</dd>
670 <h4 class=
"returnvalue">Return Value
</h4>
671 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
672 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
673 <p class=
"description">Temporarily lock access to a file.
</p>
675 int cupsFileLock (
<br>
676 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
677 int block
<br>
679 <h4 class=
"parameters">Parameters
</h4>
682 <dd class=
"description">CUPS file
</dd>
684 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
686 <h4 class=
"returnvalue">Return Value
</h4>
687 <p class=
"description">0 on success, -
1 on error
</p>
688 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
689 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
691 int cupsFileNumber (
<br>
692 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
694 <h4 class=
"parameters">Parameters
</h4>
697 <dd class=
"description">CUPS file
</dd>
699 <h4 class=
"returnvalue">Return Value
</h4>
700 <p class=
"description">File descriptor
</p>
701 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
702 <p class=
"description">Open a CUPS file.
</p>
704 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
705 const char *filename,
<br>
706 const char *mode
<br>
708 <h4 class=
"parameters">Parameters
</h4>
711 <dd class=
"description">Name of file
</dd>
713 <dd class=
"description">Open mode
</dd>
715 <h4 class=
"returnvalue">Return Value
</h4>
716 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
717 <h4 class=
"discussion">Discussion
</h4>
718 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
719 existing file,
"a
" to append to an existing file or create a new file,
720 or
"s
" to open a socket connection.
<br>
722 When opening for writing (
"w
"), an optional number from
1 to
9 can be
723 supplied which enables Flate compression of the file. Compression is
724 not supported for the
"a
" (append) mode.
<br>
726 When opening a socket connection, the filename is a string of the form
727 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
728 connection as needed, generally preferring IPv6 connections when there is
732 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
733 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
735 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
736 int fd,
<br>
737 const char *mode
<br>
739 <h4 class=
"parameters">Parameters
</h4>
742 <dd class=
"description">File descriptor
</dd>
744 <dd class=
"description">Open mode
</dd>
746 <h4 class=
"returnvalue">Return Value
</h4>
747 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
748 <h4 class=
"discussion">Discussion
</h4>
749 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
750 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
752 When opening for writing (
"w
"), an optional number from
1 to
9 can be
753 supplied which enables Flate compression of the file. Compression is
754 not supported for the
"a
" (append) mode.
757 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
758 <p class=
"description">Peek at the next character from a file.
</p>
760 int cupsFilePeekChar (
<br>
761 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
763 <h4 class=
"parameters">Parameters
</h4>
766 <dd class=
"description">CUPS file
</dd>
768 <h4 class=
"returnvalue">Return Value
</h4>
769 <p class=
"description">Character or -
1 on end of file
</p>
770 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
771 <p class=
"description">Write a formatted string.
</p>
773 int cupsFilePrintf (
<br>
774 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
775 const char *format,
<br>
776 ...
<br>
778 <h4 class=
"parameters">Parameters
</h4>
781 <dd class=
"description">CUPS file
</dd>
783 <dd class=
"description">Printf-style format string
</dd>
785 <dd class=
"description">Additional args as necessary
</dd>
787 <h4 class=
"returnvalue">Return Value
</h4>
788 <p class=
"description">Number of bytes written or -
1 on error
</p>
789 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
790 <p class=
"description">Write a character.
</p>
792 int cupsFilePutChar (
<br>
793 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
794 int c
<br>
796 <h4 class=
"parameters">Parameters
</h4>
799 <dd class=
"description">CUPS file
</dd>
801 <dd class=
"description">Character to write
</dd>
803 <h4 class=
"returnvalue">Return Value
</h4>
804 <p class=
"description">0 on success, -
1 on error
</p>
805 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
806 <p class=
"description">Write a configuration line.
</p>
808 ssize_t cupsFilePutConf (
<br>
809 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
810 const char *directive,
<br>
811 const char *value
<br>
813 <h4 class=
"parameters">Parameters
</h4>
816 <dd class=
"description">CUPS file
</dd>
818 <dd class=
"description">Directive
</dd>
820 <dd class=
"description">Value
</dd>
822 <h4 class=
"returnvalue">Return Value
</h4>
823 <p class=
"description">Number of bytes written or -
1 on error
</p>
824 <h4 class=
"discussion">Discussion
</h4>
825 <p class=
"discussion">This function handles any comment escaping of the value.
828 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
829 <p class=
"description">Write a string.
</p>
831 int cupsFilePuts (
<br>
832 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
833 const char *s
<br>
835 <h4 class=
"parameters">Parameters
</h4>
838 <dd class=
"description">CUPS file
</dd>
840 <dd class=
"description">String to write
</dd>
842 <h4 class=
"returnvalue">Return Value
</h4>
843 <p class=
"description">Number of bytes written or -
1 on error
</p>
844 <h4 class=
"discussion">Discussion
</h4>
845 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
848 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
849 <p class=
"description">Read from a file.
</p>
851 ssize_t cupsFileRead (
<br>
852 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
853 char *buf,
<br>
854 size_t bytes
<br>
856 <h4 class=
"parameters">Parameters
</h4>
859 <dd class=
"description">CUPS file
</dd>
861 <dd class=
"description">Buffer
</dd>
863 <dd class=
"description">Number of bytes to read
</dd>
865 <h4 class=
"returnvalue">Return Value
</h4>
866 <p class=
"description">Number of bytes read or -
1 on error
</p>
867 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
868 <p class=
"description">Set the current file position to the beginning of the
871 off_t cupsFileRewind (
<br>
872 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
874 <h4 class=
"parameters">Parameters
</h4>
877 <dd class=
"description">CUPS file
</dd>
879 <h4 class=
"returnvalue">Return Value
</h4>
880 <p class=
"description">New file position or -
1 on error
</p>
881 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
882 <p class=
"description">Seek in a file.
</p>
884 off_t cupsFileSeek (
<br>
885 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
886 off_t pos
<br>
888 <h4 class=
"parameters">Parameters
</h4>
891 <dd class=
"description">CUPS file
</dd>
893 <dd class=
"description">Position in file
</dd>
895 <h4 class=
"returnvalue">Return Value
</h4>
896 <p class=
"description">New file position or -
1 on error
</p>
897 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
898 <p class=
"description">Return a CUPS file associated with stderr.
</p>
900 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
901 <h4 class=
"returnvalue">Return Value
</h4>
902 <p class=
"description">CUPS file
</p>
903 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
904 <p class=
"description">Return a CUPS file associated with stdin.
</p>
906 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
907 <h4 class=
"returnvalue">Return Value
</h4>
908 <p class=
"description">CUPS file
</p>
909 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
910 <p class=
"description">Return a CUPS file associated with stdout.
</p>
912 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
913 <h4 class=
"returnvalue">Return Value
</h4>
914 <p class=
"description">CUPS file
</p>
915 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
916 <p class=
"description">Return the current file position.
</p>
918 off_t cupsFileTell (
<br>
919 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
921 <h4 class=
"parameters">Parameters
</h4>
924 <dd class=
"description">CUPS file
</dd>
926 <h4 class=
"returnvalue">Return Value
</h4>
927 <p class=
"description">File position
</p>
928 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
929 <p class=
"description">Unlock access to a file.
</p>
931 int cupsFileUnlock (
<br>
932 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
934 <h4 class=
"parameters">Parameters
</h4>
937 <dd class=
"description">CUPS file
</dd>
939 <h4 class=
"returnvalue">Return Value
</h4>
940 <p class=
"description">0 on success, -
1 on error
</p>
941 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
942 <p class=
"description">Write to a file.
</p>
944 ssize_t cupsFileWrite (
<br>
945 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
946 const char *buf,
<br>
947 size_t bytes
<br>
949 <h4 class=
"parameters">Parameters
</h4>
952 <dd class=
"description">CUPS file
</dd>
954 <dd class=
"description">Buffer
</dd>
956 <dd class=
"description">Number of bytes to write
</dd>
958 <h4 class=
"returnvalue">Return Value
</h4>
959 <p class=
"description">Number of bytes written or -
1 on error
</p>
960 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
961 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
962 <p class=
"description">Directory entry type
</p>
964 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
966 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
967 <p class=
"description">Directory type
</p>
969 typedef struct _cups_dir_s cups_dir_t;
971 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
972 <p class=
"description">CUPS file type
</p>
974 typedef struct _cups_file_s cups_file_t;
976 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
977 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
978 <p class=
"description">Directory entry type
</p>
979 <p class=
"code">struct cups_dentry_s {
<br>
980 struct stat fileinfo;
<br>
981 char filename[
260];
<br>
983 <h4 class=
"members">Members
</h4>
986 <dd class=
"description">File information
</dd>
987 <dt>filename[
260]
</dt>
988 <dd class=
"description">File name
</dd>