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 http-equiv=
"Content-Type" content=
"text/html;charset=utf-8">
8 <meta name=
"creator" content=
"Mini-XML v2.8">
9 <style type=
"text/css"><!--
11 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
14 H1, H2, H3, H4, H5, H6, P, TD, TH {
15 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
19 font-family: monaco, courier, monospace;
24 font-family: monaco, courier, monospace;
28 border: dotted thin #7f7f7f;
56 border: dotted thin #999999;
61 PRE.command EM, PRE.example EM {
62 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
66 font-family: monaco, courier, monospace;
77 border: solid thin #999999;
88 -moz-border-radius: 10px;
93 text-decoration: none;
96 A:link:hover, A:visited:hover, A:active {
97 text-decoration: underline;
104 TR.data, TD.data, TR.data TD {
107 border-bottom: solid 1pt #999999;
111 border-bottom: solid 1pt #999999;
118 border: solid thin #999999;
119 border-collapse: collapse;
135 border: solid thin #cccccc;
142 border-bottom: solid thin #999999;
151 caption-side: bottom;
175 border: thin solid black;
183 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
192 border-bottom: solid 2pt #000000;
195 DIV.indent, TABLE.indent {
203 border-collapse: collapse;
206 TABLE.indent TD, TABLE.indent TH {
211 border-collapse: collapse;
219 border-bottom: solid thin #cccccc;
224 vertical-align: bottom;
233 border-bottom: solid thin #eeeeee;
238 TABLE.list TR:nth-child(even) {
242 TABLE.list TR:nth-child(odd) {
261 font-family: monaco, courier, monospace;
265 border: solid thin #999999;
266 border-collapse: collapse;
271 DIV.summary TABLE TD, DIV.summary TABLE TH {
272 border: solid thin #999999;
278 DIV.summary TABLE THEAD TH {
282 /* API documentation styles... */
289 div.body h3, div.body h4, div.body h5 {
290 margin-bottom: 0.5em;
293 .class, .enumeration, .function, .struct, .typedef, .union {
294 border-bottom: solid thin #999999;
301 code, p.code, pre, ul.code li {
302 font-family: monaco, courier, monospace;
305 ul.code, ul.contents, ul.subcontents {
306 list-style-type: none;
316 ul.contents li ul.code, ul.contents li ul.subcontents {
329 margin-bottom: 0.5em;
332 /* This is just for the HTML files generated with the framedhelp target */
335 border: solid thin black;
344 div.contents ul.contents {
347 div.contents ul.subcontents li {
356 "$Id: api-filedir.header 7279 2008-01-31 01:50:44Z mike $"
358 File and Directory API header for CUPS.
360 Copyright 2008-2011 by Apple Inc.
362 These coded instructions, statements, and computer programs are the
363 property of Apple Inc. and are protected by Federal copyright
364 law. Distribution and use rights are outlined in the file "LICENSE.txt"
365 which should have been included with this file. If this file is
366 file is missing or damaged, see the license at "http://www.cups.org/".
369 <h1 class='title'
>File and Directory APIs
</h1>
371 <div class='summary'
><table summary='General Information'
>
386 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
387 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
391 <h2 class=
"title">Contents
</h2>
392 <ul class=
"contents">
393 <li><a href=
"#OVERVIEW">Overview
</a></li>
394 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
395 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
396 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
397 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
398 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
399 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
400 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
401 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
402 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
403 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
404 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
405 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file.">cupsFileGetConf
</a></li>
406 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
407 contain binary data.">cupsFileGetLine
</a></li>
408 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
409 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
410 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
411 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
412 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
413 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
414 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
415 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
416 <li><a href=
"#cupsFilePutConf" title=
"Write a configuration line.">cupsFilePutConf
</a></li>
417 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
418 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
419 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
420 file.">cupsFileRewind
</a></li>
421 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
422 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
423 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
424 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
425 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
426 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
427 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
429 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
430 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
431 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
432 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
434 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
435 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
439 "$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
441 File and directory API introduction for CUPS.
443 Copyright 2007-2011 by Apple Inc.
444 Copyright 1997-2005 by Easy Software Products, all rights reserved.
446 These coded instructions, statements, and computer programs are the
447 property of Apple Inc. and are protected by Federal copyright
448 law. Distribution and use rights are outlined in the file "LICENSE.txt"
449 which should have been included with this file. If this file is
450 file is missing or damaged, see the license at "http://www.cups.org/".
453 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
455 <p>The CUPS file and directory APIs provide portable interfaces
456 for manipulating files and listing files and directories. Unlike
457 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
458 allow you to open more than
256 files at any given time. They
459 also manage the platform-specific details of locking, large file
460 support, line endings (CR, LF, or CR LF), and reading and writing
461 files using Flate (
"gzip") compression. Finally, you can also
462 connect, read from, and write to network connections using the
463 <code>cupsFile
</code> functions.
</p>
465 <p>The
<code>cupsDir
</code> functions manage the platform-specific
466 details of directory access/listing and provide a convenient way
467 to get both a list of files and the information (permissions,
468 size, timestamp, etc.) for each of those files.
</p>
469 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
470 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
471 <p class=
"description">Close a directory.
</p>
473 void cupsDirClose (
<br>
474 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
476 <h4 class=
"parameters">Parameters
</h4>
479 <dd class=
"description">Directory pointer
</dd>
481 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
482 <p class=
"description">Open a directory.
</p>
484 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
485 const char *directory
<br>
487 <h4 class=
"parameters">Parameters
</h4>
490 <dd class=
"description">Directory name
</dd>
492 <h4 class=
"returnvalue">Return Value
</h4>
493 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
494 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
495 <p class=
"description">Read the next directory entry.
</p>
497 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
498 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
500 <h4 class=
"parameters">Parameters
</h4>
503 <dd class=
"description">Directory pointer
</dd>
505 <h4 class=
"returnvalue">Return Value
</h4>
506 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
507 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
508 <p class=
"description">Rewind to the start of the directory.
</p>
510 void cupsDirRewind (
<br>
511 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
513 <h4 class=
"parameters">Parameters
</h4>
516 <dd class=
"description">Directory pointer
</dd>
518 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
519 <p class=
"description">Close a CUPS file.
</p>
521 int cupsFileClose (
<br>
522 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
524 <h4 class=
"parameters">Parameters
</h4>
527 <dd class=
"description">CUPS file
</dd>
529 <h4 class=
"returnvalue">Return Value
</h4>
530 <p class=
"description">0 on success, -
1 on error
</p>
531 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
532 <p class=
"description">Return whether a file is compressed.
</p>
534 int cupsFileCompression (
<br>
535 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
537 <h4 class=
"parameters">Parameters
</h4>
540 <dd class=
"description">CUPS file
</dd>
542 <h4 class=
"returnvalue">Return Value
</h4>
543 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
544 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
545 <p class=
"description">Return the end-of-file status.
</p>
547 int cupsFileEOF (
<br>
548 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
550 <h4 class=
"parameters">Parameters
</h4>
553 <dd class=
"description">CUPS file
</dd>
555 <h4 class=
"returnvalue">Return Value
</h4>
556 <p class=
"description">1 on end of file,
0 otherwise
</p>
557 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
558 <p class=
"description">Find a file using the specified path.
</p>
560 const char *cupsFileFind (
<br>
561 const char *filename,
<br>
562 const char *path,
<br>
563 int executable,
<br>
564 char *buffer,
<br>
565 int bufsize
<br>
567 <h4 class=
"parameters">Parameters
</h4>
570 <dd class=
"description">File to find
</dd>
572 <dd class=
"description">Colon/semicolon-separated path
</dd>
574 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
576 <dd class=
"description">Filename buffer
</dd>
578 <dd class=
"description">Size of filename buffer
</dd>
580 <h4 class=
"returnvalue">Return Value
</h4>
581 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
582 <h4 class=
"discussion">Discussion
</h4>
583 <p class=
"discussion">This function allows the paths in the path string to be separated by
584 colons (UNIX standard) or semicolons (Windows standard) and stores the
585 result in the buffer supplied. If the file cannot be found in any of
586 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
587 matches the current directory.
590 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
591 <p class=
"description">Flush pending output.
</p>
593 int cupsFileFlush (
<br>
594 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
596 <h4 class=
"parameters">Parameters
</h4>
599 <dd class=
"description">CUPS file
</dd>
601 <h4 class=
"returnvalue">Return Value
</h4>
602 <p class=
"description">0 on success, -
1 on error
</p>
603 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
604 <p class=
"description">Get a single character from a file.
</p>
606 int cupsFileGetChar (
<br>
607 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
609 <h4 class=
"parameters">Parameters
</h4>
612 <dd class=
"description">CUPS file
</dd>
614 <h4 class=
"returnvalue">Return Value
</h4>
615 <p class=
"description">Character or -
1 on end of file
</p>
616 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
617 <p class=
"description">Get a line from a configuration file.
</p>
619 char *cupsFileGetConf (
<br>
620 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
621 char *buf,
<br>
622 size_t buflen,
<br>
623 char **value,
<br>
624 int *linenum
<br>
626 <h4 class=
"parameters">Parameters
</h4>
629 <dd class=
"description">CUPS file
</dd>
631 <dd class=
"description">String buffer
</dd>
633 <dd class=
"description">Size of string buffer
</dd>
635 <dd class=
"description">Pointer to value
</dd>
637 <dd class=
"description">Current line number
</dd>
639 <h4 class=
"returnvalue">Return Value
</h4>
640 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
641 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
642 <p class=
"description">Get a CR and/or LF-terminated line that may
643 contain binary data.
</p>
645 size_t cupsFileGetLine (
<br>
646 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
647 char *buf,
<br>
648 size_t buflen
<br>
650 <h4 class=
"parameters">Parameters
</h4>
653 <dd class=
"description">File to read from
</dd>
655 <dd class=
"description">Buffer
</dd>
657 <dd class=
"description">Size of buffer
</dd>
659 <h4 class=
"returnvalue">Return Value
</h4>
660 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
661 <h4 class=
"discussion">Discussion
</h4>
662 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
663 and LF are preserved, as is any binary data on the line. The buffer is
664 nul-terminated, however you should use the returned length to determine
665 the number of bytes on the line.
668 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
669 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
671 char *cupsFileGets (
<br>
672 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
673 char *buf,
<br>
674 size_t buflen
<br>
676 <h4 class=
"parameters">Parameters
</h4>
679 <dd class=
"description">CUPS file
</dd>
681 <dd class=
"description">String buffer
</dd>
683 <dd class=
"description">Size of string buffer
</dd>
685 <h4 class=
"returnvalue">Return Value
</h4>
686 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
687 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
688 <p class=
"description">Temporarily lock access to a file.
</p>
690 int cupsFileLock (
<br>
691 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
692 int block
<br>
694 <h4 class=
"parameters">Parameters
</h4>
697 <dd class=
"description">CUPS file
</dd>
699 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
701 <h4 class=
"returnvalue">Return Value
</h4>
702 <p class=
"description">0 on success, -
1 on error
</p>
703 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
704 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
706 int cupsFileNumber (
<br>
707 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
709 <h4 class=
"parameters">Parameters
</h4>
712 <dd class=
"description">CUPS file
</dd>
714 <h4 class=
"returnvalue">Return Value
</h4>
715 <p class=
"description">File descriptor
</p>
716 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
717 <p class=
"description">Open a CUPS file.
</p>
719 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
720 const char *filename,
<br>
721 const char *mode
<br>
723 <h4 class=
"parameters">Parameters
</h4>
726 <dd class=
"description">Name of file
</dd>
728 <dd class=
"description">Open mode
</dd>
730 <h4 class=
"returnvalue">Return Value
</h4>
731 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
732 <h4 class=
"discussion">Discussion
</h4>
733 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
734 existing file,
"a
" to append to an existing file or create a new file,
735 or
"s
" to open a socket connection.
<br>
737 When opening for writing (
"w
"), an optional number from
1 to
9 can be
738 supplied which enables Flate compression of the file. Compression is
739 not supported for the
"a
" (append) mode.
<br>
741 When opening a socket connection, the filename is a string of the form
742 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
743 connection as needed, generally preferring IPv6 connections when there is
747 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
748 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
750 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
751 int fd,
<br>
752 const char *mode
<br>
754 <h4 class=
"parameters">Parameters
</h4>
757 <dd class=
"description">File descriptor
</dd>
759 <dd class=
"description">Open mode
</dd>
761 <h4 class=
"returnvalue">Return Value
</h4>
762 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
763 <h4 class=
"discussion">Discussion
</h4>
764 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
765 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
767 When opening for writing (
"w
"), an optional number from
1 to
9 can be
768 supplied which enables Flate compression of the file. Compression is
769 not supported for the
"a
" (append) mode.
772 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
773 <p class=
"description">Peek at the next character from a file.
</p>
775 int cupsFilePeekChar (
<br>
776 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
778 <h4 class=
"parameters">Parameters
</h4>
781 <dd class=
"description">CUPS file
</dd>
783 <h4 class=
"returnvalue">Return Value
</h4>
784 <p class=
"description">Character or -
1 on end of file
</p>
785 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
786 <p class=
"description">Write a formatted string.
</p>
788 int cupsFilePrintf (
<br>
789 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
790 const char *format,
<br>
791 ...
<br>
793 <h4 class=
"parameters">Parameters
</h4>
796 <dd class=
"description">CUPS file
</dd>
798 <dd class=
"description">Printf-style format string
</dd>
800 <dd class=
"description">Additional args as necessary
</dd>
802 <h4 class=
"returnvalue">Return Value
</h4>
803 <p class=
"description">Number of bytes written or -
1 on error
</p>
804 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
805 <p class=
"description">Write a character.
</p>
807 int cupsFilePutChar (
<br>
808 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
809 int c
<br>
811 <h4 class=
"parameters">Parameters
</h4>
814 <dd class=
"description">CUPS file
</dd>
816 <dd class=
"description">Character to write
</dd>
818 <h4 class=
"returnvalue">Return Value
</h4>
819 <p class=
"description">0 on success, -
1 on error
</p>
820 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
821 <p class=
"description">Write a configuration line.
</p>
823 ssize_t cupsFilePutConf (
<br>
824 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
825 const char *directive,
<br>
826 const char *value
<br>
828 <h4 class=
"parameters">Parameters
</h4>
831 <dd class=
"description">CUPS file
</dd>
833 <dd class=
"description">Directive
</dd>
835 <dd class=
"description">Value
</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">This function handles any comment escaping of the value.
843 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
844 <p class=
"description">Write a string.
</p>
846 int cupsFilePuts (
<br>
847 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
848 const char *s
<br>
850 <h4 class=
"parameters">Parameters
</h4>
853 <dd class=
"description">CUPS file
</dd>
855 <dd class=
"description">String to write
</dd>
857 <h4 class=
"returnvalue">Return Value
</h4>
858 <p class=
"description">Number of bytes written or -
1 on error
</p>
859 <h4 class=
"discussion">Discussion
</h4>
860 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
863 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
864 <p class=
"description">Read from a file.
</p>
866 ssize_t cupsFileRead (
<br>
867 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
868 char *buf,
<br>
869 size_t bytes
<br>
871 <h4 class=
"parameters">Parameters
</h4>
874 <dd class=
"description">CUPS file
</dd>
876 <dd class=
"description">Buffer
</dd>
878 <dd class=
"description">Number of bytes to read
</dd>
880 <h4 class=
"returnvalue">Return Value
</h4>
881 <p class=
"description">Number of bytes read or -
1 on error
</p>
882 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
883 <p class=
"description">Set the current file position to the beginning of the
886 off_t cupsFileRewind (
<br>
887 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
889 <h4 class=
"parameters">Parameters
</h4>
892 <dd class=
"description">CUPS file
</dd>
894 <h4 class=
"returnvalue">Return Value
</h4>
895 <p class=
"description">New file position or -
1 on error
</p>
896 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
897 <p class=
"description">Seek in a file.
</p>
899 off_t cupsFileSeek (
<br>
900 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
901 off_t pos
<br>
903 <h4 class=
"parameters">Parameters
</h4>
906 <dd class=
"description">CUPS file
</dd>
908 <dd class=
"description">Position in file
</dd>
910 <h4 class=
"returnvalue">Return Value
</h4>
911 <p class=
"description">New file position or -
1 on error
</p>
912 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
913 <p class=
"description">Return a CUPS file associated with stderr.
</p>
915 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
916 <h4 class=
"returnvalue">Return Value
</h4>
917 <p class=
"description">CUPS file
</p>
918 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
919 <p class=
"description">Return a CUPS file associated with stdin.
</p>
921 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
922 <h4 class=
"returnvalue">Return Value
</h4>
923 <p class=
"description">CUPS file
</p>
924 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
925 <p class=
"description">Return a CUPS file associated with stdout.
</p>
927 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
928 <h4 class=
"returnvalue">Return Value
</h4>
929 <p class=
"description">CUPS file
</p>
930 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
931 <p class=
"description">Return the current file position.
</p>
933 off_t cupsFileTell (
<br>
934 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
936 <h4 class=
"parameters">Parameters
</h4>
939 <dd class=
"description">CUPS file
</dd>
941 <h4 class=
"returnvalue">Return Value
</h4>
942 <p class=
"description">File position
</p>
943 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
944 <p class=
"description">Unlock access to a file.
</p>
946 int cupsFileUnlock (
<br>
947 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
949 <h4 class=
"parameters">Parameters
</h4>
952 <dd class=
"description">CUPS file
</dd>
954 <h4 class=
"returnvalue">Return Value
</h4>
955 <p class=
"description">0 on success, -
1 on error
</p>
956 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
957 <p class=
"description">Write to a file.
</p>
959 ssize_t cupsFileWrite (
<br>
960 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
961 const char *buf,
<br>
962 size_t bytes
<br>
964 <h4 class=
"parameters">Parameters
</h4>
967 <dd class=
"description">CUPS file
</dd>
969 <dd class=
"description">Buffer
</dd>
971 <dd class=
"description">Number of bytes to write
</dd>
973 <h4 class=
"returnvalue">Return Value
</h4>
974 <p class=
"description">Number of bytes written or -
1 on error
</p>
975 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
976 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
977 <p class=
"description">Directory entry type
</p>
979 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
981 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
982 <p class=
"description">Directory type
</p>
984 typedef struct _cups_dir_s cups_dir_t;
986 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
987 <p class=
"description">CUPS file type
</p>
989 typedef struct _cups_file_s cups_file_t;
991 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
992 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
993 <p class=
"description">Directory entry type
</p>
994 <p class=
"code">struct cups_dentry_s {
<br>
995 struct stat fileinfo;
<br>
996 char filename[
260];
<br>
998 <h4 class=
"members">Members
</h4>
1001 <dd class=
"description">File information
</dd>
1002 <dt>filename[
260]
</dt>
1003 <dd class=
"description">File name
</dd>