1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/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.5">
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;
32 border: dotted thin #999999;
37 PRE.command EM, PRE.example EM {
38 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
42 font-family: monaco, courier, monospace;
53 border: solid thin #999999;
58 text-decoration: none;
62 A:link:hover, A:visited:hover, A:active {
63 text-decoration: underline;
72 border: solid thin #999999;
73 border-collapse: collapse;
89 border: solid thin #cccccc;
96 border-bottom: solid thin #999999;
105 caption-side: bottom;
125 border: thin solid #000000;
133 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
139 border-bottom: solid 2pt #000000;
157 font-family: monaco, courier, monospace;
166 border: solid thin #999999;
167 border-collapse: collapse;
172 DIV.summary TABLE TD, DIV.summary TABLE TH {
173 border: solid thin #999999;
179 DIV.summary TABLE THEAD TH {
183 /* API documentation styles... */
190 div.body h3, div.body h4, div.body h5 {
191 margin-bottom: 0.5em;
194 .class, .enumeration, .function, .struct, .typedef, .union {
195 border-bottom: solid thin #999999;
202 code, p.code, pre, ul.code li {
203 font-family: monaco, courier, monospace;
206 ul.code, ul.contents, ul.subcontents {
207 list-style-type: none;
217 ul.contents li ul.code, ul.contents li ul.subcontents {
230 margin-bottom: 0.5em;
233 /* This is just for the HTML files generated with the framedhelp target */
236 border: solid thin black;
245 div.contents ul.contents {
253 "$Id: api-filedir.header 7279 2008-01-31 01:50:44Z mike $"
255 File and Directory API header for the Common UNIX Printing System (CUPS).
257 Copyright 2008 by Apple Inc.
259 These coded instructions, statements, and computer programs are the
260 property of Apple Inc. and are protected by Federal copyright
261 law. Distribution and use rights are outlined in the file "LICENSE.txt"
262 which should have been included with this file. If this file is
263 file is missing or damaged, see the license at "http://www.cups.org/".
266 <h1 class=
"title">File and Directory APIs
</h1>
268 <div class='summary'
><table summary='General Information'
>
283 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
284 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
288 <h2 class=
"title">Contents
</h2>
289 <ul class=
"contents">
291 <li><a href=
"#OVERVIEW">Overview
</a></li>
292 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
293 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
294 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
295 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
296 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
297 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
298 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
299 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
300 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
301 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
302 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
303 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file...">cupsFileGetConf
</a></li>
304 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
305 contain binary data.">cupsFileGetLine
</a></li>
306 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
307 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
308 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
309 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
310 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
311 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
312 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
313 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
314 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
315 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
316 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
317 file.">cupsFileRewind
</a></li>
318 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
319 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
320 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
321 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
322 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
323 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
324 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
326 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
327 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
328 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
329 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
331 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
332 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
336 "$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
338 File and directory API introduction for the Common UNIX Printing System (CUPS).
340 Copyright 2007-2008 by Apple Inc.
341 Copyright 1997-2005 by Easy Software Products, all rights reserved.
343 These coded instructions, statements, and computer programs are the
344 property of Apple Inc. and are protected by Federal copyright
345 law. Distribution and use rights are outlined in the file "LICENSE.txt"
346 which should have been included with this file. If this file is
347 file is missing or damaged, see the license at "http://www.cups.org/".
350 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
352 <p>The CUPS file and directory APIs provide portable interfaces
353 for manipulating files and listing files and directories. Unlike
354 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
355 allow you to open more than
256 files at any given time. They
356 also manage the platform-specific details of locking, large file
357 support, line endings (CR, LF, or CR LF), and reading and writing
358 files using Flate (
"gzip") compression. Finally, you can also
359 connect, read from, and write to network connections using the
360 <code>cupsFile
</code> functions.
</p>
362 <p>The
<code>cupsDir
</code> functions manage the platform-specific
363 details of directory access/listing and provide a convenient way
364 to get both a list of files and the information (permissions,
365 size, timestamp, etc.) for each of those files.
</p>
366 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
367 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
368 <p class=
"description">Close a directory.
</p>
370 void cupsDirClose (
<br>
371 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
373 <h4 class=
"parameters">Parameters
</h4>
376 <dd class=
"description">Directory pointer
</dd>
378 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
379 <p class=
"description">Open a directory.
</p>
381 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
382 const char *directory
<br>
384 <h4 class=
"parameters">Parameters
</h4>
387 <dd class=
"description">Directory name
</dd>
389 <h4 class=
"returnvalue">Return Value
</h4>
390 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
391 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
392 <p class=
"description">Read the next directory entry.
</p>
394 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
395 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
397 <h4 class=
"parameters">Parameters
</h4>
400 <dd class=
"description">Directory pointer
</dd>
402 <h4 class=
"returnvalue">Return Value
</h4>
403 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
404 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
405 <p class=
"description">Rewind to the start of the directory.
</p>
407 void cupsDirRewind (
<br>
408 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
410 <h4 class=
"parameters">Parameters
</h4>
413 <dd class=
"description">Directory pointer
</dd>
415 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
416 <p class=
"description">Close a CUPS file.
</p>
418 int cupsFileClose (
<br>
419 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
421 <h4 class=
"parameters">Parameters
</h4>
424 <dd class=
"description">CUPS file
</dd>
426 <h4 class=
"returnvalue">Return Value
</h4>
427 <p class=
"description">0 on success, -
1 on error
</p>
428 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
429 <p class=
"description">Return whether a file is compressed.
</p>
431 int cupsFileCompression (
<br>
432 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
434 <h4 class=
"parameters">Parameters
</h4>
437 <dd class=
"description">CUPS file
</dd>
439 <h4 class=
"returnvalue">Return Value
</h4>
440 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
441 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
442 <p class=
"description">Return the end-of-file status.
</p>
444 int cupsFileEOF (
<br>
445 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
447 <h4 class=
"parameters">Parameters
</h4>
450 <dd class=
"description">CUPS file
</dd>
452 <h4 class=
"returnvalue">Return Value
</h4>
453 <p class=
"description">1 on end of file,
0 otherwise
</p>
454 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
455 <p class=
"description">Find a file using the specified path.
</p>
457 const char *cupsFileFind (
<br>
458 const char *filename,
<br>
459 const char *path,
<br>
460 int executable,
<br>
461 char *buffer,
<br>
462 int bufsize
<br>
464 <h4 class=
"parameters">Parameters
</h4>
467 <dd class=
"description">File to find
</dd>
469 <dd class=
"description">Colon/semicolon-separated path
</dd>
471 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
473 <dd class=
"description">Filename buffer
</dd>
475 <dd class=
"description">Size of filename buffer
</dd>
477 <h4 class=
"returnvalue">Return Value
</h4>
478 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
479 <h4 class=
"discussion">Discussion
</h4>
480 <p class=
"discussion">This function allows the paths in the path string to be separated by
481 colons (UNIX standard) or semicolons (Windows standard) and stores the
482 result in the buffer supplied. If the file cannot be found in any of
483 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
484 matches the current directory.
487 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
488 <p class=
"description">Flush pending output.
</p>
490 int cupsFileFlush (
<br>
491 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
493 <h4 class=
"parameters">Parameters
</h4>
496 <dd class=
"description">CUPS file
</dd>
498 <h4 class=
"returnvalue">Return Value
</h4>
499 <p class=
"description">0 on success, -
1 on error
</p>
500 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
501 <p class=
"description">Get a single character from a file.
</p>
503 int cupsFileGetChar (
<br>
504 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
506 <h4 class=
"parameters">Parameters
</h4>
509 <dd class=
"description">CUPS file
</dd>
511 <h4 class=
"returnvalue">Return Value
</h4>
512 <p class=
"description">Character or -
1 on end of file
</p>
513 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
514 <p class=
"description">Get a line from a configuration file...
</p>
516 char *cupsFileGetConf (
<br>
517 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
518 char *buf,
<br>
519 size_t buflen,
<br>
520 char **value,
<br>
521 int *linenum
<br>
523 <h4 class=
"parameters">Parameters
</h4>
526 <dd class=
"description">CUPS file
</dd>
528 <dd class=
"description">String buffer
</dd>
530 <dd class=
"description">Size of string buffer
</dd>
532 <dd class=
"description">Pointer to value
</dd>
534 <dd class=
"description">Current line number
</dd>
536 <h4 class=
"returnvalue">Return Value
</h4>
537 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
538 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
539 <p class=
"description">Get a CR and/or LF-terminated line that may
540 contain binary data.
</p>
542 size_t cupsFileGetLine (
<br>
543 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
544 char *buf,
<br>
545 size_t buflen
<br>
547 <h4 class=
"parameters">Parameters
</h4>
550 <dd class=
"description">File to read from
</dd>
552 <dd class=
"description">Buffer
</dd>
554 <dd class=
"description">Size of buffer
</dd>
556 <h4 class=
"returnvalue">Return Value
</h4>
557 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
558 <h4 class=
"discussion">Discussion
</h4>
559 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
560 and LF are preserved, as is any binary data on the line. The buffer is
561 nul-terminated, however you should use the returned length to determine
562 the number of bytes on the line.
565 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
566 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
568 char *cupsFileGets (
<br>
569 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
570 char *buf,
<br>
571 size_t buflen
<br>
573 <h4 class=
"parameters">Parameters
</h4>
576 <dd class=
"description">CUPS file
</dd>
578 <dd class=
"description">String buffer
</dd>
580 <dd class=
"description">Size of string buffer
</dd>
582 <h4 class=
"returnvalue">Return Value
</h4>
583 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
584 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
585 <p class=
"description">Temporarily lock access to a file.
</p>
587 int cupsFileLock (
<br>
588 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
589 int block
<br>
591 <h4 class=
"parameters">Parameters
</h4>
594 <dd class=
"description">CUPS file
</dd>
596 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
598 <h4 class=
"returnvalue">Return Value
</h4>
599 <p class=
"description">0 on success, -
1 on error
</p>
600 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
601 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
603 int cupsFileNumber (
<br>
604 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
606 <h4 class=
"parameters">Parameters
</h4>
609 <dd class=
"description">CUPS file
</dd>
611 <h4 class=
"returnvalue">Return Value
</h4>
612 <p class=
"description">File descriptor
</p>
613 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
614 <p class=
"description">Open a CUPS file.
</p>
616 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
617 const char *filename,
<br>
618 const char *mode
<br>
620 <h4 class=
"parameters">Parameters
</h4>
623 <dd class=
"description">Name of file
</dd>
625 <dd class=
"description">Open mode
</dd>
627 <h4 class=
"returnvalue">Return Value
</h4>
628 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
629 <h4 class=
"discussion">Discussion
</h4>
630 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
631 existing file,
"a
" to append to an existing file or create a new file,
632 or
"s
" to open a socket connection.
<br>
634 When opening for writing (
"w
") or appending (
"a
"), an optional number from
635 1 to
9 can be supplied which enables Flate compression of the file.
<br>
637 When opening a socket connection, the filename is a string of the form
638 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
639 connection as needed, generally preferring IPv6 connections when there is
643 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
644 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
646 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
647 int fd,
<br>
648 const char *mode
<br>
650 <h4 class=
"parameters">Parameters
</h4>
653 <dd class=
"description">File descriptor
</dd>
655 <dd class=
"description">Open mode
</dd>
657 <h4 class=
"returnvalue">Return Value
</h4>
658 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
659 <h4 class=
"discussion">Discussion
</h4>
660 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"a
" or
"w
" to write, or
"s
"
661 to treat the file descriptor as a bidirectional socket connection.
<br>
663 When opening for writing (
"w
") or appending (
"a
"), an optional number from
664 1 to
9 can be supplied which enables Flate compression of the file.
667 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
668 <p class=
"description">Peek at the next character from a file.
</p>
670 int cupsFilePeekChar (
<br>
671 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
673 <h4 class=
"parameters">Parameters
</h4>
676 <dd class=
"description">CUPS file
</dd>
678 <h4 class=
"returnvalue">Return Value
</h4>
679 <p class=
"description">Character or -
1 on end of file
</p>
680 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
681 <p class=
"description">Write a formatted string.
</p>
683 int cupsFilePrintf (
<br>
684 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
685 const char *format,
<br>
686 ...
<br>
688 <h4 class=
"parameters">Parameters
</h4>
691 <dd class=
"description">CUPS file
</dd>
693 <dd class=
"description">Printf-style format string
</dd>
695 <dd class=
"description">Additional args as necessary
</dd>
697 <h4 class=
"returnvalue">Return Value
</h4>
698 <p class=
"description">Number of bytes written or -
1 on error
</p>
699 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
700 <p class=
"description">Write a character.
</p>
702 int cupsFilePutChar (
<br>
703 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
704 int c
<br>
706 <h4 class=
"parameters">Parameters
</h4>
709 <dd class=
"description">CUPS file
</dd>
711 <dd class=
"description">Character to write
</dd>
713 <h4 class=
"returnvalue">Return Value
</h4>
714 <p class=
"description">0 on success, -
1 on error
</p>
715 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
716 <p class=
"description">Write a string.
</p>
718 int cupsFilePuts (
<br>
719 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
720 const char *s
<br>
722 <h4 class=
"parameters">Parameters
</h4>
725 <dd class=
"description">CUPS file
</dd>
727 <dd class=
"description">String to write
</dd>
729 <h4 class=
"returnvalue">Return Value
</h4>
730 <p class=
"description">Number of bytes written or -
1 on error
</p>
731 <h4 class=
"discussion">Discussion
</h4>
732 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
735 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
736 <p class=
"description">Read from a file.
</p>
738 ssize_t cupsFileRead (
<br>
739 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
740 char *buf,
<br>
741 size_t bytes
<br>
743 <h4 class=
"parameters">Parameters
</h4>
746 <dd class=
"description">CUPS file
</dd>
748 <dd class=
"description">Buffer
</dd>
750 <dd class=
"description">Number of bytes to read
</dd>
752 <h4 class=
"returnvalue">Return Value
</h4>
753 <p class=
"description">Number of bytes read or -
1 on error
</p>
754 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
755 <p class=
"description">Set the current file position to the beginning of the
758 off_t cupsFileRewind (
<br>
759 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
761 <h4 class=
"parameters">Parameters
</h4>
764 <dd class=
"description">CUPS file
</dd>
766 <h4 class=
"returnvalue">Return Value
</h4>
767 <p class=
"description">New file position or -
1 on error
</p>
768 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
769 <p class=
"description">Seek in a file.
</p>
771 off_t cupsFileSeek (
<br>
772 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
773 off_t pos
<br>
775 <h4 class=
"parameters">Parameters
</h4>
778 <dd class=
"description">CUPS file
</dd>
780 <dd class=
"description">Position in file
</dd>
782 <h4 class=
"returnvalue">Return Value
</h4>
783 <p class=
"description">New file position or -
1 on error
</p>
784 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
785 <p class=
"description">Return a CUPS file associated with stderr.
</p>
787 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
788 <h4 class=
"returnvalue">Return Value
</h4>
789 <p class=
"description">CUPS file
</p>
790 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
791 <p class=
"description">Return a CUPS file associated with stdin.
</p>
793 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
794 <h4 class=
"returnvalue">Return Value
</h4>
795 <p class=
"description">CUPS file
</p>
796 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
797 <p class=
"description">Return a CUPS file associated with stdout.
</p>
799 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
800 <h4 class=
"returnvalue">Return Value
</h4>
801 <p class=
"description">CUPS file
</p>
802 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
803 <p class=
"description">Return the current file position.
</p>
805 off_t cupsFileTell (
<br>
806 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
808 <h4 class=
"parameters">Parameters
</h4>
811 <dd class=
"description">CUPS file
</dd>
813 <h4 class=
"returnvalue">Return Value
</h4>
814 <p class=
"description">File position
</p>
815 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
816 <p class=
"description">Unlock access to a file.
</p>
818 int cupsFileUnlock (
<br>
819 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
821 <h4 class=
"parameters">Parameters
</h4>
824 <dd class=
"description">CUPS file
</dd>
826 <h4 class=
"returnvalue">Return Value
</h4>
827 <p class=
"description">0 on success, -
1 on error
</p>
828 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
829 <p class=
"description">Write to a file.
</p>
831 ssize_t cupsFileWrite (
<br>
832 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
833 const char *buf,
<br>
834 size_t bytes
<br>
836 <h4 class=
"parameters">Parameters
</h4>
839 <dd class=
"description">CUPS file
</dd>
841 <dd class=
"description">Buffer
</dd>
843 <dd class=
"description">Number of bytes to write
</dd>
845 <h4 class=
"returnvalue">Return Value
</h4>
846 <p class=
"description">Number of bytes written or -
1 on error
</p>
847 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
848 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
849 <p class=
"description">Directory entry type
</p>
851 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
853 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
854 <p class=
"description">Directory type
</p>
856 typedef struct _cups_dir_s cups_dir_t;
858 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
859 <p class=
"description">CUPS file type
</p>
861 typedef struct _cups_file_s cups_file_t;
863 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
864 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
865 <p class=
"description">Directory entry type
</p>
866 <p class=
"code">struct cups_dentry_s {
<br>
867 struct stat fileinfo;
<br>
868 char filename[
260];
<br>
870 <h4 class=
"members">Members
</h4>
873 <dd class=
"description">File information
</dd>
874 <dt>filename[
260]
</dt>
875 <dd class=
"description">File name
</dd>