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.7">
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;
44 border: dotted thin #999999;
49 PRE.command EM, PRE.example EM {
50 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
54 font-family: monaco, courier, monospace;
65 border: solid thin #999999;
76 -moz-border-radius: 10px;
81 text-decoration: none;
84 A:link:hover, A:visited:hover, A:active {
85 text-decoration: underline;
92 TR.data, TD.data, TR.data TD {
95 border-bottom: solid 1pt #999999;
99 border-bottom: solid 1pt #999999;
106 border: solid thin #999999;
107 border-collapse: collapse;
123 border: solid thin #cccccc;
130 border-bottom: solid thin #999999;
139 caption-side: bottom;
163 border: thin solid black;
171 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
180 border-bottom: solid 2pt #000000;
183 DIV.indent, TABLE.indent {
191 border-collapse: collapse;
194 TABLE.indent TD, TABLE.indent TH {
199 border-collapse: collapse;
207 border-bottom: solid thin #cccccc;
212 vertical-align: bottom;
221 border-bottom: solid thin #eeeeee;
226 TABLE.list TR:nth-child(even) {
230 TABLE.list TR:nth-child(odd) {
249 font-family: monaco, courier, monospace;
253 border: solid thin #999999;
254 border-collapse: collapse;
259 DIV.summary TABLE TD, DIV.summary TABLE TH {
260 border: solid thin #999999;
266 DIV.summary TABLE THEAD TH {
270 /* API documentation styles... */
277 div.body h3, div.body h4, div.body h5 {
278 margin-bottom: 0.5em;
281 .class, .enumeration, .function, .struct, .typedef, .union {
282 border-bottom: solid thin #999999;
289 code, p.code, pre, ul.code li {
290 font-family: monaco, courier, monospace;
293 ul.code, ul.contents, ul.subcontents {
294 list-style-type: none;
304 ul.contents li ul.code, ul.contents li ul.subcontents {
317 margin-bottom: 0.5em;
320 /* This is just for the HTML files generated with the framedhelp target */
323 border: solid thin black;
332 div.contents ul.contents {
335 div.contents ul.subcontents li {
344 "$Id: api-filedir.header 7279 2008-01-31 01:50:44Z mike $"
346 File and Directory API header for CUPS.
348 Copyright 2008-2011 by Apple Inc.
350 These coded instructions, statements, and computer programs are the
351 property of Apple Inc. and are protected by Federal copyright
352 law. Distribution and use rights are outlined in the file "LICENSE.txt"
353 which should have been included with this file. If this file is
354 file is missing or damaged, see the license at "http://www.cups.org/".
357 <h1 class='title'
>File and Directory APIs
</h1>
359 <div class='summary'
><table summary='General Information'
>
374 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
375 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
379 <h2 class=
"title">Contents
</h2>
380 <ul class=
"contents">
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>
427 "$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
429 File and directory API introduction for CUPS.
431 Copyright 2007-2011 by Apple Inc.
432 Copyright 1997-2005 by Easy Software Products, all rights reserved.
434 These coded instructions, statements, and computer programs are the
435 property of Apple Inc. and are protected by Federal copyright
436 law. Distribution and use rights are outlined in the file "LICENSE.txt"
437 which should have been included with this file. If this file is
438 file is missing or damaged, see the license at "http://www.cups.org/".
441 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
443 <p>The CUPS file and directory APIs provide portable interfaces
444 for manipulating files and listing files and directories. Unlike
445 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
446 allow you to open more than
256 files at any given time. They
447 also manage the platform-specific details of locking, large file
448 support, line endings (CR, LF, or CR LF), and reading and writing
449 files using Flate (
"gzip") compression. Finally, you can also
450 connect, read from, and write to network connections using the
451 <code>cupsFile
</code> functions.
</p>
453 <p>The
<code>cupsDir
</code> functions manage the platform-specific
454 details of directory access/listing and provide a convenient way
455 to get both a list of files and the information (permissions,
456 size, timestamp, etc.) for each of those files.
</p>
457 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
458 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
459 <p class=
"description">Close a directory.
</p>
461 void cupsDirClose (
<br>
462 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
464 <h4 class=
"parameters">Parameters
</h4>
467 <dd class=
"description">Directory pointer
</dd>
469 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
470 <p class=
"description">Open a directory.
</p>
472 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
473 const char *directory
<br>
475 <h4 class=
"parameters">Parameters
</h4>
478 <dd class=
"description">Directory name
</dd>
480 <h4 class=
"returnvalue">Return Value
</h4>
481 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
482 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
483 <p class=
"description">Read the next directory entry.
</p>
485 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
486 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
488 <h4 class=
"parameters">Parameters
</h4>
491 <dd class=
"description">Directory pointer
</dd>
493 <h4 class=
"returnvalue">Return Value
</h4>
494 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
495 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
496 <p class=
"description">Rewind to the start of the directory.
</p>
498 void cupsDirRewind (
<br>
499 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
501 <h4 class=
"parameters">Parameters
</h4>
504 <dd class=
"description">Directory pointer
</dd>
506 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
507 <p class=
"description">Close a CUPS file.
</p>
509 int cupsFileClose (
<br>
510 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
512 <h4 class=
"parameters">Parameters
</h4>
515 <dd class=
"description">CUPS file
</dd>
517 <h4 class=
"returnvalue">Return Value
</h4>
518 <p class=
"description">0 on success, -
1 on error
</p>
519 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
520 <p class=
"description">Return whether a file is compressed.
</p>
522 int cupsFileCompression (
<br>
523 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
525 <h4 class=
"parameters">Parameters
</h4>
528 <dd class=
"description">CUPS file
</dd>
530 <h4 class=
"returnvalue">Return Value
</h4>
531 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
532 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
533 <p class=
"description">Return the end-of-file status.
</p>
535 int cupsFileEOF (
<br>
536 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
538 <h4 class=
"parameters">Parameters
</h4>
541 <dd class=
"description">CUPS file
</dd>
543 <h4 class=
"returnvalue">Return Value
</h4>
544 <p class=
"description">1 on end of file,
0 otherwise
</p>
545 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
546 <p class=
"description">Find a file using the specified path.
</p>
548 const char *cupsFileFind (
<br>
549 const char *filename,
<br>
550 const char *path,
<br>
551 int executable,
<br>
552 char *buffer,
<br>
553 int bufsize
<br>
555 <h4 class=
"parameters">Parameters
</h4>
558 <dd class=
"description">File to find
</dd>
560 <dd class=
"description">Colon/semicolon-separated path
</dd>
562 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
564 <dd class=
"description">Filename buffer
</dd>
566 <dd class=
"description">Size of filename buffer
</dd>
568 <h4 class=
"returnvalue">Return Value
</h4>
569 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
570 <h4 class=
"discussion">Discussion
</h4>
571 <p class=
"discussion">This function allows the paths in the path string to be separated by
572 colons (UNIX standard) or semicolons (Windows standard) and stores the
573 result in the buffer supplied. If the file cannot be found in any of
574 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
575 matches the current directory.
578 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
579 <p class=
"description">Flush pending output.
</p>
581 int cupsFileFlush (
<br>
582 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
584 <h4 class=
"parameters">Parameters
</h4>
587 <dd class=
"description">CUPS file
</dd>
589 <h4 class=
"returnvalue">Return Value
</h4>
590 <p class=
"description">0 on success, -
1 on error
</p>
591 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
592 <p class=
"description">Get a single character from a file.
</p>
594 int cupsFileGetChar (
<br>
595 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
597 <h4 class=
"parameters">Parameters
</h4>
600 <dd class=
"description">CUPS file
</dd>
602 <h4 class=
"returnvalue">Return Value
</h4>
603 <p class=
"description">Character or -
1 on end of file
</p>
604 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
605 <p class=
"description">Get a line from a configuration file.
</p>
607 char *cupsFileGetConf (
<br>
608 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
609 char *buf,
<br>
610 size_t buflen,
<br>
611 char **value,
<br>
612 int *linenum
<br>
614 <h4 class=
"parameters">Parameters
</h4>
617 <dd class=
"description">CUPS file
</dd>
619 <dd class=
"description">String buffer
</dd>
621 <dd class=
"description">Size of string buffer
</dd>
623 <dd class=
"description">Pointer to value
</dd>
625 <dd class=
"description">Current line number
</dd>
627 <h4 class=
"returnvalue">Return Value
</h4>
628 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
629 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
630 <p class=
"description">Get a CR and/or LF-terminated line that may
631 contain binary data.
</p>
633 size_t cupsFileGetLine (
<br>
634 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
635 char *buf,
<br>
636 size_t buflen
<br>
638 <h4 class=
"parameters">Parameters
</h4>
641 <dd class=
"description">File to read from
</dd>
643 <dd class=
"description">Buffer
</dd>
645 <dd class=
"description">Size of buffer
</dd>
647 <h4 class=
"returnvalue">Return Value
</h4>
648 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
649 <h4 class=
"discussion">Discussion
</h4>
650 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
651 and LF are preserved, as is any binary data on the line. The buffer is
652 nul-terminated, however you should use the returned length to determine
653 the number of bytes on the line.
656 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
657 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
659 char *cupsFileGets (
<br>
660 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
661 char *buf,
<br>
662 size_t buflen
<br>
664 <h4 class=
"parameters">Parameters
</h4>
667 <dd class=
"description">CUPS file
</dd>
669 <dd class=
"description">String buffer
</dd>
671 <dd class=
"description">Size of string buffer
</dd>
673 <h4 class=
"returnvalue">Return Value
</h4>
674 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
675 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
676 <p class=
"description">Temporarily lock access to a file.
</p>
678 int cupsFileLock (
<br>
679 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
680 int block
<br>
682 <h4 class=
"parameters">Parameters
</h4>
685 <dd class=
"description">CUPS file
</dd>
687 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
689 <h4 class=
"returnvalue">Return Value
</h4>
690 <p class=
"description">0 on success, -
1 on error
</p>
691 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
692 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
694 int cupsFileNumber (
<br>
695 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
697 <h4 class=
"parameters">Parameters
</h4>
700 <dd class=
"description">CUPS file
</dd>
702 <h4 class=
"returnvalue">Return Value
</h4>
703 <p class=
"description">File descriptor
</p>
704 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
705 <p class=
"description">Open a CUPS file.
</p>
707 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
708 const char *filename,
<br>
709 const char *mode
<br>
711 <h4 class=
"parameters">Parameters
</h4>
714 <dd class=
"description">Name of file
</dd>
716 <dd class=
"description">Open mode
</dd>
718 <h4 class=
"returnvalue">Return Value
</h4>
719 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
720 <h4 class=
"discussion">Discussion
</h4>
721 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
722 existing file,
"a
" to append to an existing file or create a new file,
723 or
"s
" to open a socket connection.
<br>
725 When opening for writing (
"w
"), an optional number from
1 to
9 can be
726 supplied which enables Flate compression of the file. Compression is
727 not supported for the
"a
" (append) mode.
<br>
729 When opening a socket connection, the filename is a string of the form
730 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
731 connection as needed, generally preferring IPv6 connections when there is
735 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
736 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
738 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
739 int fd,
<br>
740 const char *mode
<br>
742 <h4 class=
"parameters">Parameters
</h4>
745 <dd class=
"description">File descriptor
</dd>
747 <dd class=
"description">Open mode
</dd>
749 <h4 class=
"returnvalue">Return Value
</h4>
750 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
751 <h4 class=
"discussion">Discussion
</h4>
752 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
753 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
755 When opening for writing (
"w
"), an optional number from
1 to
9 can be
756 supplied which enables Flate compression of the file. Compression is
757 not supported for the
"a
" (append) mode.
760 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
761 <p class=
"description">Peek at the next character from a file.
</p>
763 int cupsFilePeekChar (
<br>
764 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
766 <h4 class=
"parameters">Parameters
</h4>
769 <dd class=
"description">CUPS file
</dd>
771 <h4 class=
"returnvalue">Return Value
</h4>
772 <p class=
"description">Character or -
1 on end of file
</p>
773 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
774 <p class=
"description">Write a formatted string.
</p>
776 int cupsFilePrintf (
<br>
777 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
778 const char *format,
<br>
779 ...
<br>
781 <h4 class=
"parameters">Parameters
</h4>
784 <dd class=
"description">CUPS file
</dd>
786 <dd class=
"description">Printf-style format string
</dd>
788 <dd class=
"description">Additional args as necessary
</dd>
790 <h4 class=
"returnvalue">Return Value
</h4>
791 <p class=
"description">Number of bytes written or -
1 on error
</p>
792 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
793 <p class=
"description">Write a character.
</p>
795 int cupsFilePutChar (
<br>
796 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
797 int c
<br>
799 <h4 class=
"parameters">Parameters
</h4>
802 <dd class=
"description">CUPS file
</dd>
804 <dd class=
"description">Character to write
</dd>
806 <h4 class=
"returnvalue">Return Value
</h4>
807 <p class=
"description">0 on success, -
1 on error
</p>
808 <h3 class=
"function"><span class=
"info"> CUPS
1.4/OS X
10.6 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
809 <p class=
"description">Write a configuration line.
</p>
811 ssize_t cupsFilePutConf (
<br>
812 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
813 const char *directive,
<br>
814 const char *value
<br>
816 <h4 class=
"parameters">Parameters
</h4>
819 <dd class=
"description">CUPS file
</dd>
821 <dd class=
"description">Directive
</dd>
823 <dd class=
"description">Value
</dd>
825 <h4 class=
"returnvalue">Return Value
</h4>
826 <p class=
"description">Number of bytes written or -
1 on error
</p>
827 <h4 class=
"discussion">Discussion
</h4>
828 <p class=
"discussion">This function handles any comment escaping of the value.
831 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
832 <p class=
"description">Write a string.
</p>
834 int cupsFilePuts (
<br>
835 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
836 const char *s
<br>
838 <h4 class=
"parameters">Parameters
</h4>
841 <dd class=
"description">CUPS file
</dd>
843 <dd class=
"description">String to write
</dd>
845 <h4 class=
"returnvalue">Return Value
</h4>
846 <p class=
"description">Number of bytes written or -
1 on error
</p>
847 <h4 class=
"discussion">Discussion
</h4>
848 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
851 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
852 <p class=
"description">Read from a file.
</p>
854 ssize_t cupsFileRead (
<br>
855 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
856 char *buf,
<br>
857 size_t bytes
<br>
859 <h4 class=
"parameters">Parameters
</h4>
862 <dd class=
"description">CUPS file
</dd>
864 <dd class=
"description">Buffer
</dd>
866 <dd class=
"description">Number of bytes to read
</dd>
868 <h4 class=
"returnvalue">Return Value
</h4>
869 <p class=
"description">Number of bytes read or -
1 on error
</p>
870 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
871 <p class=
"description">Set the current file position to the beginning of the
874 off_t cupsFileRewind (
<br>
875 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
877 <h4 class=
"parameters">Parameters
</h4>
880 <dd class=
"description">CUPS file
</dd>
882 <h4 class=
"returnvalue">Return Value
</h4>
883 <p class=
"description">New file position or -
1 on error
</p>
884 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
885 <p class=
"description">Seek in a file.
</p>
887 off_t cupsFileSeek (
<br>
888 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
889 off_t pos
<br>
891 <h4 class=
"parameters">Parameters
</h4>
894 <dd class=
"description">CUPS file
</dd>
896 <dd class=
"description">Position in file
</dd>
898 <h4 class=
"returnvalue">Return Value
</h4>
899 <p class=
"description">New file position or -
1 on error
</p>
900 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
901 <p class=
"description">Return a CUPS file associated with stderr.
</p>
903 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
904 <h4 class=
"returnvalue">Return Value
</h4>
905 <p class=
"description">CUPS file
</p>
906 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
907 <p class=
"description">Return a CUPS file associated with stdin.
</p>
909 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
910 <h4 class=
"returnvalue">Return Value
</h4>
911 <p class=
"description">CUPS file
</p>
912 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
913 <p class=
"description">Return a CUPS file associated with stdout.
</p>
915 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (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=
"cupsFileTell">cupsFileTell
</a></h3>
919 <p class=
"description">Return the current file position.
</p>
921 off_t cupsFileTell (
<br>
922 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
924 <h4 class=
"parameters">Parameters
</h4>
927 <dd class=
"description">CUPS file
</dd>
929 <h4 class=
"returnvalue">Return Value
</h4>
930 <p class=
"description">File position
</p>
931 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
932 <p class=
"description">Unlock access to a file.
</p>
934 int cupsFileUnlock (
<br>
935 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
937 <h4 class=
"parameters">Parameters
</h4>
940 <dd class=
"description">CUPS file
</dd>
942 <h4 class=
"returnvalue">Return Value
</h4>
943 <p class=
"description">0 on success, -
1 on error
</p>
944 <h3 class=
"function"><span class=
"info"> CUPS
1.2/OS X
10.5 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
945 <p class=
"description">Write to a file.
</p>
947 ssize_t cupsFileWrite (
<br>
948 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
949 const char *buf,
<br>
950 size_t bytes
<br>
952 <h4 class=
"parameters">Parameters
</h4>
955 <dd class=
"description">CUPS file
</dd>
957 <dd class=
"description">Buffer
</dd>
959 <dd class=
"description">Number of bytes to write
</dd>
961 <h4 class=
"returnvalue">Return Value
</h4>
962 <p class=
"description">Number of bytes written or -
1 on error
</p>
963 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
964 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
965 <p class=
"description">Directory entry type
</p>
967 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
969 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
970 <p class=
"description">Directory type
</p>
972 typedef struct _cups_dir_s cups_dir_t;
974 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
975 <p class=
"description">CUPS file type
</p>
977 typedef struct _cups_file_s cups_file_t;
979 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
980 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
981 <p class=
"description">Directory entry type
</p>
982 <p class=
"code">struct cups_dentry_s {
<br>
983 struct stat fileinfo;
<br>
984 char filename[
260];
<br>
986 <h4 class=
"members">Members
</h4>
989 <dd class=
"description">File information
</dd>
990 <dt>filename[
260]
</dt>
991 <dd class=
"description">File name
</dd>