kusano 7d535a
.\" $Id: TIFFWriteDirectory.3tiff,v 1.3 2010-12-12 01:45:35 faxguy Exp $
kusano 7d535a
.\"
kusano 7d535a
.\" Copyright (c) 1988-1997 Sam Leffler
kusano 7d535a
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
kusano 7d535a
.\"
kusano 7d535a
.\" Permission to use, copy, modify, distribute, and sell this software and 
kusano 7d535a
.\" its documentation for any purpose is hereby granted without fee, provided
kusano 7d535a
.\" that (i) the above copyright notices and this permission notice appear in
kusano 7d535a
.\" all copies of the software and related documentation, and (ii) the names of
kusano 7d535a
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
kusano 7d535a
.\" publicity relating to the software without the specific, prior written
kusano 7d535a
.\" permission of Sam Leffler and Silicon Graphics.
kusano 7d535a
.\" 
kusano 7d535a
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
kusano 7d535a
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
kusano 7d535a
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
kusano 7d535a
.\" 
kusano 7d535a
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
kusano 7d535a
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
kusano 7d535a
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
kusano 7d535a
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
kusano 7d535a
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
kusano 7d535a
.\" OF THIS SOFTWARE.
kusano 7d535a
.\"
kusano 7d535a
.if n .po 0
kusano 7d535a
.TH TIFFWriteDirectory 3TIFF "September 26, 2001" "libtiff"
kusano 7d535a
.SH NAME
kusano 7d535a
TIFFWriteDirectory, TIFFRewriteDirectory, TIFFCheckpointDirectory \- write the
kusano 7d535a
current directory in an open
kusano 7d535a
.SM TIFF
kusano 7d535a
file
kusano 7d535a
.SH SYNOPSIS
kusano 7d535a
.B "#include <tiffio.h>"</tiffio.h>
kusano 7d535a
.sp
kusano 7d535a
.BI "int TIFFWriteDirectory(TIFF *" tif ")"
kusano 7d535a
.br
kusano 7d535a
.BI "int TIFFRewriteDirectory(TIFF *" tif ")"
kusano 7d535a
.br
kusano 7d535a
.BI "int TIFFCheckpointDirectory(TIFF *" tif ")"
kusano 7d535a
.SH DESCRIPTION
kusano 7d535a
.IR TIFFWriteDirectory 
kusano 7d535a
will write the contents of the current directory to the file and setup to
kusano 7d535a
create a new subfile in the same file. Applications only need to call
kusano 7d535a
.IR TIFFWriteDirectory
kusano 7d535a
when writing multiple subfiles to a single
kusano 7d535a
.SM TIFF
kusano 7d535a
file.
kusano 7d535a
.IR TIFFWriteDirectory
kusano 7d535a
is automatically called by
kusano 7d535a
.IR TIFFClose
kusano 7d535a
and
kusano 7d535a
.IR TIFFFlush
kusano 7d535a
to write a modified directory if the file is open for writing.
kusano 7d535a
.PP
kusano 7d535a
The 
kusano 7d535a
.IR TIFFRewriteDirectory
kusano 7d535a
function operates similarly to 
kusano 7d535a
.IR TIFFWriteDirectory,
kusano 7d535a
but can be called with directories previously read or written that already
kusano 7d535a
have an established location in the file.  It will rewrite the directory,
kusano 7d535a
but instead of place it at it's old location (as 
kusano 7d535a
.IR TIFFWriteDirectory
kusano 7d535a
would) it will place them at the end of the file, correcting the pointer from
kusano 7d535a
the preceding directory or file header to point to it's new location.  This
kusano 7d535a
is particularly important in cases where the size of the directory and
kusano 7d535a
pointed to data has grown, so it won't fit in the space available at the
kusano 7d535a
old location.
kusano 7d535a
.PP
kusano 7d535a
The
kusano 7d535a
.IR TIFFCheckpointDirectory
kusano 7d535a
writes the current state of the tiff directory into the file to make what
kusano 7d535a
is currently in the file readable.  Unlike
kusano 7d535a
.IR TIFFWriteDirectory,
kusano 7d535a
.IR TIFFCheckpointDirectory
kusano 7d535a
does not free up the directory data structures in memory, so they can be
kusano 7d535a
updated (as strips/tiles are written) and written again.  Reading such
kusano 7d535a
a partial file you will at worst get a tiff read error for the first
kusano 7d535a
strip/tile encountered that is incomplete, but you will at least get
kusano 7d535a
all the valid data in the file before that.  When the file is complete,
kusano 7d535a
just use
kusano 7d535a
.IR TIFFWriteDirectory
kusano 7d535a
as usual to finish it off cleanly.
kusano 7d535a
.SH "RETURN VALUES"
kusano 7d535a
1 is returned when the contents are successfully written to the file.
kusano 7d535a
Otherwise, 0 is returned if an error was encountered when writing
kusano 7d535a
the directory contents.
kusano 7d535a
.SH DIAGNOSTICS
kusano 7d535a
All error messages are directed to the
kusano 7d535a
.IR TIFFError (3TIFF)
kusano 7d535a
routine.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error post-encoding before directory write" .
kusano 7d535a
Before writing the contents of the current directory, any pending data are
kusano 7d535a
flushed. This message indicates that an error occurred while doing this.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error flushing data before directory write" .
kusano 7d535a
Before writing the contents of the current directory, any pending data are
kusano 7d535a
flushed. This message indicates that an error occurred while doing this.
kusano 7d535a
.PP
kusano 7d535a
.BR "Cannot write directory, out of space" .
kusano 7d535a
There was not enough space to allocate a temporary area for the directory that
kusano 7d535a
was to be written.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error writing directory count" .
kusano 7d535a
A write error occurred when writing the count of fields in the directory.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error writing directory contents" .
kusano 7d535a
A write error occurred when writing the directory fields.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error writing directory link" .
kusano 7d535a
A write error occurred when writing the link to the next directory.
kusano 7d535a
.PP
kusano 7d535a
\fBError writing data for field "%s"\fP.
kusano 7d535a
A write error occurred when writing indirect data for the specified field.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error writing TIFF header" .
kusano 7d535a
A write error occurred when re-writing header at the front of the file.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error fetching directory count" .
kusano 7d535a
A read error occurred when fetching the directory count field for
kusano 7d535a
a previous directory.
kusano 7d535a
This can occur when setting up a link to the directory that is being
kusano 7d535a
written.
kusano 7d535a
.PP
kusano 7d535a
.BR "Error fetching directory link" .
kusano 7d535a
A read error occurred when fetching the directory link field for
kusano 7d535a
a previous directory.
kusano 7d535a
This can occur when setting up a link to the directory that is being
kusano 7d535a
written.
kusano 7d535a
.SH "SEE ALSO"
kusano 7d535a
.BR TIFFOpen (3TIFF),
kusano 7d535a
.BR TIFFError (3TIFF),
kusano 7d535a
.BR TIFFReadDirectory (3TIFF),
kusano 7d535a
.BR TIFFSetDirectory (3TIFF),
kusano 7d535a
.BR libtiff (3TIFF)
kusano 7d535a
.PP
kusano 7d535a
Libtiff library home page:
kusano 7d535a
.BR http://www.remotesensing.org/libtiff/