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;
27 border: dotted thin #7f7f7f;
43 border: dotted thin #999999;
48 PRE.command EM, PRE.example EM {
49 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
53 font-family: monaco, courier, monospace;
64 border: solid thin #999999;
75 -moz-border-radius: 10px;
80 text-decoration: none;
83 A:link:hover, A:visited:hover, A:active {
84 text-decoration: underline;
91 TR.data, TD.data, TR.data TD {
94 border-bottom: solid 1pt #999999;
98 border-bottom: solid 1pt #999999;
105 border: solid thin #999999;
106 border-collapse: collapse;
122 border: solid thin #cccccc;
129 border-bottom: solid thin #999999;
138 caption-side: bottom;
162 border: thin solid black;
170 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
179 border-bottom: solid 2pt #000000;
182 DIV.indent, TABLE.indent {
190 border-collapse: collapse;
193 TABLE.indent TD, TABLE.indent TH {
198 border-collapse: collapse;
206 border-bottom: solid thin #cccccc;
211 vertical-align: bottom;
220 border-bottom: solid thin #eeeeee;
225 TABLE.list TR:nth-child(even) {
229 TABLE.list TR:nth-child(odd) {
248 font-family: monaco, courier, monospace;
252 border: solid thin #999999;
253 border-collapse: collapse;
258 DIV.summary TABLE TD, DIV.summary TABLE TH {
259 border: solid thin #999999;
265 DIV.summary TABLE THEAD TH {
269 /* API documentation styles... */
276 div.body h3, div.body h4, div.body h5 {
277 margin-bottom: 0.5em;
280 .class, .enumeration, .function, .struct, .typedef, .union {
281 border-bottom: solid thin #999999;
288 code, p.code, pre, ul.code li {
289 font-family: monaco, courier, monospace;
292 ul.code, ul.contents, ul.subcontents {
293 list-style-type: none;
303 ul.contents li ul.code, ul.contents li ul.subcontents {
316 margin-bottom: 0.5em;
319 /* This is just for the HTML files generated with the framedhelp target */
322 border: solid thin black;
331 div.contents ul.contents {
334 div.contents ul.subcontents li {
345 File and Directory API header for the Common UNIX Printing System (CUPS).
347 Copyright 2008-2009 by Apple Inc.
349 These coded instructions, statements, and computer programs are the
350 property of Apple Inc. and are protected by Federal copyright
351 law. Distribution and use rights are outlined in the file "LICENSE.txt"
352 which should have been included with this file. If this file is
353 file is missing or damaged, see the license at "http://www.cups.org/".
356 <h1 class='title'
>File and Directory APIs
</h1>
358 <div class='summary'
><table summary='General Information'
>
373 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
374 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
378 <h2 class=
"title">Contents
</h2>
379 <ul class=
"contents">
380 <ul class=
"subcontents">
381 <li><a href=
"#OVERVIEW">Overview
</a></li>
382 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
383 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
384 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
385 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
386 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
387 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
388 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
389 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
390 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
391 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
392 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
393 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file...">cupsFileGetConf
</a></li>
394 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
395 contain binary data.">cupsFileGetLine
</a></li>
396 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
397 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
398 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
399 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
400 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
401 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
402 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
403 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
404 <li><a href=
"#cupsFilePutConf" title=
"Write a configuration line.">cupsFilePutConf
</a></li>
405 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
406 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
407 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
408 file.">cupsFileRewind
</a></li>
409 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
410 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
411 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
412 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
413 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
414 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
415 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
417 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
418 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
419 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
420 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
422 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
423 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
428 File and directory API introduction for the Common UNIX Printing System (CUPS).
430 Copyright 2007-2008 by Apple Inc.
431 Copyright 1997-2005 by Easy Software Products, all rights reserved.
433 These coded instructions, statements, and computer programs are the
434 property of Apple Inc. and are protected by Federal copyright
435 law. Distribution and use rights are outlined in the file "LICENSE.txt"
436 which should have been included with this file. If this file is
437 file is missing or damaged, see the license at "http://www.cups.org/".
440 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
442 <p>The CUPS file and directory APIs provide portable interfaces
443 for manipulating files and listing files and directories. Unlike
444 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
445 allow you to open more than
256 files at any given time. They
446 also manage the platform-specific details of locking, large file
447 support, line endings (CR, LF, or CR LF), and reading and writing
448 files using Flate (
"gzip") compression. Finally, you can also
449 connect, read from, and write to network connections using the
450 <code>cupsFile
</code> functions.
</p>
452 <p>The
<code>cupsDir
</code> functions manage the platform-specific
453 details of directory access/listing and provide a convenient way
454 to get both a list of files and the information (permissions,
455 size, timestamp, etc.) for each of those files.
</p>
456 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
457 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
458 <p class=
"description">Close a directory.
</p>
460 void cupsDirClose (
<br>
461 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
463 <h4 class=
"parameters">Parameters
</h4>
466 <dd class=
"description">Directory pointer
</dd>
468 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
469 <p class=
"description">Open a directory.
</p>
471 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
472 const char *directory
<br>
474 <h4 class=
"parameters">Parameters
</h4>
477 <dd class=
"description">Directory name
</dd>
479 <h4 class=
"returnvalue">Return Value
</h4>
480 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
481 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
482 <p class=
"description">Read the next directory entry.
</p>
484 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
485 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
487 <h4 class=
"parameters">Parameters
</h4>
490 <dd class=
"description">Directory pointer
</dd>
492 <h4 class=
"returnvalue">Return Value
</h4>
493 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
494 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
495 <p class=
"description">Rewind to the start of the directory.
</p>
497 void cupsDirRewind (
<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 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
506 <p class=
"description">Close a CUPS file.
</p>
508 int cupsFileClose (
<br>
509 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
511 <h4 class=
"parameters">Parameters
</h4>
514 <dd class=
"description">CUPS file
</dd>
516 <h4 class=
"returnvalue">Return Value
</h4>
517 <p class=
"description">0 on success, -
1 on error
</p>
518 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
519 <p class=
"description">Return whether a file is compressed.
</p>
521 int cupsFileCompression (
<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"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
531 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
532 <p class=
"description">Return the end-of-file status.
</p>
534 int cupsFileEOF (
<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">1 on end of file,
0 otherwise
</p>
544 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
545 <p class=
"description">Find a file using the specified path.
</p>
547 const char *cupsFileFind (
<br>
548 const char *filename,
<br>
549 const char *path,
<br>
550 int executable,
<br>
551 char *buffer,
<br>
552 int bufsize
<br>
554 <h4 class=
"parameters">Parameters
</h4>
557 <dd class=
"description">File to find
</dd>
559 <dd class=
"description">Colon/semicolon-separated path
</dd>
561 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
563 <dd class=
"description">Filename buffer
</dd>
565 <dd class=
"description">Size of filename buffer
</dd>
567 <h4 class=
"returnvalue">Return Value
</h4>
568 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
569 <h4 class=
"discussion">Discussion
</h4>
570 <p class=
"discussion">This function allows the paths in the path string to be separated by
571 colons (UNIX standard) or semicolons (Windows standard) and stores the
572 result in the buffer supplied. If the file cannot be found in any of
573 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
574 matches the current directory.
577 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
578 <p class=
"description">Flush pending output.
</p>
580 int cupsFileFlush (
<br>
581 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
583 <h4 class=
"parameters">Parameters
</h4>
586 <dd class=
"description">CUPS file
</dd>
588 <h4 class=
"returnvalue">Return Value
</h4>
589 <p class=
"description">0 on success, -
1 on error
</p>
590 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
591 <p class=
"description">Get a single character from a file.
</p>
593 int cupsFileGetChar (
<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">Character or -
1 on end of file
</p>
603 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
604 <p class=
"description">Get a line from a configuration file...
</p>
606 char *cupsFileGetConf (
<br>
607 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
608 char *buf,
<br>
609 size_t buflen,
<br>
610 char **value,
<br>
611 int *linenum
<br>
613 <h4 class=
"parameters">Parameters
</h4>
616 <dd class=
"description">CUPS file
</dd>
618 <dd class=
"description">String buffer
</dd>
620 <dd class=
"description">Size of string buffer
</dd>
622 <dd class=
"description">Pointer to value
</dd>
624 <dd class=
"description">Current line number
</dd>
626 <h4 class=
"returnvalue">Return Value
</h4>
627 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
628 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
629 <p class=
"description">Get a CR and/or LF-terminated line that may
630 contain binary data.
</p>
632 size_t cupsFileGetLine (
<br>
633 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
634 char *buf,
<br>
635 size_t buflen
<br>
637 <h4 class=
"parameters">Parameters
</h4>
640 <dd class=
"description">File to read from
</dd>
642 <dd class=
"description">Buffer
</dd>
644 <dd class=
"description">Size of buffer
</dd>
646 <h4 class=
"returnvalue">Return Value
</h4>
647 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
648 <h4 class=
"discussion">Discussion
</h4>
649 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
650 and LF are preserved, as is any binary data on the line. The buffer is
651 nul-terminated, however you should use the returned length to determine
652 the number of bytes on the line.
655 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
656 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
658 char *cupsFileGets (
<br>
659 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
660 char *buf,
<br>
661 size_t buflen
<br>
663 <h4 class=
"parameters">Parameters
</h4>
666 <dd class=
"description">CUPS file
</dd>
668 <dd class=
"description">String buffer
</dd>
670 <dd class=
"description">Size of string buffer
</dd>
672 <h4 class=
"returnvalue">Return Value
</h4>
673 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
674 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
675 <p class=
"description">Temporarily lock access to a file.
</p>
677 int cupsFileLock (
<br>
678 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
679 int block
<br>
681 <h4 class=
"parameters">Parameters
</h4>
684 <dd class=
"description">CUPS file
</dd>
686 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
688 <h4 class=
"returnvalue">Return Value
</h4>
689 <p class=
"description">0 on success, -
1 on error
</p>
690 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
691 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
693 int cupsFileNumber (
<br>
694 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
696 <h4 class=
"parameters">Parameters
</h4>
699 <dd class=
"description">CUPS file
</dd>
701 <h4 class=
"returnvalue">Return Value
</h4>
702 <p class=
"description">File descriptor
</p>
703 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
704 <p class=
"description">Open a CUPS file.
</p>
706 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
707 const char *filename,
<br>
708 const char *mode
<br>
710 <h4 class=
"parameters">Parameters
</h4>
713 <dd class=
"description">Name of file
</dd>
715 <dd class=
"description">Open mode
</dd>
717 <h4 class=
"returnvalue">Return Value
</h4>
718 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
719 <h4 class=
"discussion">Discussion
</h4>
720 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
721 existing file,
"a
" to append to an existing file or create a new file,
722 or
"s
" to open a socket connection.
<br>
724 When opening for writing (
"w
"), an optional number from
1 to
9 can be
725 supplied which enables Flate compression of the file. Compression is
726 not supported for the
"a
" (append) mode.
<br>
728 When opening a socket connection, the filename is a string of the form
729 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
730 connection as needed, generally preferring IPv6 connections when there is
734 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
735 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
737 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
738 int fd,
<br>
739 const char *mode
<br>
741 <h4 class=
"parameters">Parameters
</h4>
744 <dd class=
"description">File descriptor
</dd>
746 <dd class=
"description">Open mode
</dd>
748 <h4 class=
"returnvalue">Return Value
</h4>
749 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
750 <h4 class=
"discussion">Discussion
</h4>
751 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
752 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
754 When opening for writing (
"w
"), an optional number from
1 to
9 can be
755 supplied which enables Flate compression of the file. Compression is
756 not supported for the
"a
" (append) mode.
759 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
760 <p class=
"description">Peek at the next character from a file.
</p>
762 int cupsFilePeekChar (
<br>
763 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
765 <h4 class=
"parameters">Parameters
</h4>
768 <dd class=
"description">CUPS file
</dd>
770 <h4 class=
"returnvalue">Return Value
</h4>
771 <p class=
"description">Character or -
1 on end of file
</p>
772 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
773 <p class=
"description">Write a formatted string.
</p>
775 int cupsFilePrintf (
<br>
776 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
777 const char *format,
<br>
778 ...
<br>
780 <h4 class=
"parameters">Parameters
</h4>
783 <dd class=
"description">CUPS file
</dd>
785 <dd class=
"description">Printf-style format string
</dd>
787 <dd class=
"description">Additional args as necessary
</dd>
789 <h4 class=
"returnvalue">Return Value
</h4>
790 <p class=
"description">Number of bytes written or -
1 on error
</p>
791 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
792 <p class=
"description">Write a character.
</p>
794 int cupsFilePutChar (
<br>
795 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
796 int c
<br>
798 <h4 class=
"parameters">Parameters
</h4>
801 <dd class=
"description">CUPS file
</dd>
803 <dd class=
"description">Character to write
</dd>
805 <h4 class=
"returnvalue">Return Value
</h4>
806 <p class=
"description">0 on success, -
1 on error
</p>
807 <h3 class=
"function"><span class=
"info"> CUPS
1.4/Mac OS X
10.6 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
808 <p class=
"description">Write a configuration line.
</p>
810 ssize_t cupsFilePutConf (
<br>
811 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
812 const char *directive,
<br>
813 const char *value
<br>
815 <h4 class=
"parameters">Parameters
</h4>
818 <dd class=
"description">CUPS file
</dd>
820 <dd class=
"description">Directive
</dd>
822 <dd class=
"description">Value
</dd>
824 <h4 class=
"returnvalue">Return Value
</h4>
825 <p class=
"description">Number of bytes written or -
1 on error
</p>
826 <h4 class=
"discussion">Discussion
</h4>
827 <p class=
"discussion">This function handles any comment escaping of the value.
830 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
831 <p class=
"description">Write a string.
</p>
833 int cupsFilePuts (
<br>
834 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
835 const char *s
<br>
837 <h4 class=
"parameters">Parameters
</h4>
840 <dd class=
"description">CUPS file
</dd>
842 <dd class=
"description">String to write
</dd>
844 <h4 class=
"returnvalue">Return Value
</h4>
845 <p class=
"description">Number of bytes written or -
1 on error
</p>
846 <h4 class=
"discussion">Discussion
</h4>
847 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
850 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
851 <p class=
"description">Read from a file.
</p>
853 ssize_t cupsFileRead (
<br>
854 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
855 char *buf,
<br>
856 size_t bytes
<br>
858 <h4 class=
"parameters">Parameters
</h4>
861 <dd class=
"description">CUPS file
</dd>
863 <dd class=
"description">Buffer
</dd>
865 <dd class=
"description">Number of bytes to read
</dd>
867 <h4 class=
"returnvalue">Return Value
</h4>
868 <p class=
"description">Number of bytes read or -
1 on error
</p>
869 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
870 <p class=
"description">Set the current file position to the beginning of the
873 off_t cupsFileRewind (
<br>
874 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
876 <h4 class=
"parameters">Parameters
</h4>
879 <dd class=
"description">CUPS file
</dd>
881 <h4 class=
"returnvalue">Return Value
</h4>
882 <p class=
"description">New file position or -
1 on error
</p>
883 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
884 <p class=
"description">Seek in a file.
</p>
886 off_t cupsFileSeek (
<br>
887 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
888 off_t pos
<br>
890 <h4 class=
"parameters">Parameters
</h4>
893 <dd class=
"description">CUPS file
</dd>
895 <dd class=
"description">Position in file
</dd>
897 <h4 class=
"returnvalue">Return Value
</h4>
898 <p class=
"description">New file position or -
1 on error
</p>
899 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
900 <p class=
"description">Return a CUPS file associated with stderr.
</p>
902 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
903 <h4 class=
"returnvalue">Return Value
</h4>
904 <p class=
"description">CUPS file
</p>
905 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
906 <p class=
"description">Return a CUPS file associated with stdin.
</p>
908 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
909 <h4 class=
"returnvalue">Return Value
</h4>
910 <p class=
"description">CUPS file
</p>
911 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
912 <p class=
"description">Return a CUPS file associated with stdout.
</p>
914 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
915 <h4 class=
"returnvalue">Return Value
</h4>
916 <p class=
"description">CUPS file
</p>
917 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
918 <p class=
"description">Return the current file position.
</p>
920 off_t cupsFileTell (
<br>
921 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
923 <h4 class=
"parameters">Parameters
</h4>
926 <dd class=
"description">CUPS file
</dd>
928 <h4 class=
"returnvalue">Return Value
</h4>
929 <p class=
"description">File position
</p>
930 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
931 <p class=
"description">Unlock access to a file.
</p>
933 int cupsFileUnlock (
<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">0 on success, -
1 on error
</p>
943 <h3 class=
"function"><span class=
"info"> CUPS
1.2/Mac OS X
10.5 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
944 <p class=
"description">Write to a file.
</p>
946 ssize_t cupsFileWrite (
<br>
947 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
948 const char *buf,
<br>
949 size_t bytes
<br>
951 <h4 class=
"parameters">Parameters
</h4>
954 <dd class=
"description">CUPS file
</dd>
956 <dd class=
"description">Buffer
</dd>
958 <dd class=
"description">Number of bytes to write
</dd>
960 <h4 class=
"returnvalue">Return Value
</h4>
961 <p class=
"description">Number of bytes written or -
1 on error
</p>
962 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
963 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
964 <p class=
"description">Directory entry type
</p>
966 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
968 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
969 <p class=
"description">Directory type
</p>
971 typedef struct _cups_dir_s cups_dir_t;
973 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
974 <p class=
"description">CUPS file type
</p>
976 typedef struct _cups_file_s cups_file_t;
978 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
979 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
980 <p class=
"description">Directory entry type
</p>
981 <p class=
"code">struct cups_dentry_s {
<br>
982 struct stat fileinfo;
<br>
983 char filename[
260];
<br>
985 <h4 class=
"members">Members
</h4>
988 <dd class=
"description">File information
</dd>
989 <dt>filename[
260]
</dt>
990 <dd class=
"description">File name
</dd>