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