Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ilConnectFi(3X) — HP-UX ANSI C A.10.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ilInitFile(3X)

ilListFileImages(3X)

ilReadFileImage(3X)

ilWriteFileImage(3X)

ilConnectFile(3X)

NAME

ilConnectFile() − make a TIFF file available to Image Library calls

SYNOPSIS

ilFile
ilConnectFile (

ilContext context,

FILE *stream,

long offset,

unsigned long mustBeZero);

DESCRIPTION

ilConnectFile() makes a TIFF file available to Image Library calls.  A null TIFF file can be created by ilInitFile().  To free the returned ilFile object, use ilDestroyObject() on it, or use ilDestroyContext() on the associated context. 

ilListFileImages() can be called to get a list of images from the returned ilFile, and ilReadFileImage() can be called to read an image from the file.  If stream was opened with mode r+, images can be written to the file by using ilWriteFileImage(). 

TIFF, as well as other types of image files, can also be accessed using EFS function calls; see ilEFSOpen(3X). 

context identifies a context created by IL_CREATE_CONTEXT(). 

*stream is a pointer to a stream by which the TIFF file can be accessed; returned by fopen(3S).  A TIFF file requires random access and cannot use a stdin or stdout stream. The file must be opened with one of the following types:

r if you want read-only access to an existing file

r+ if you want read and write access to an existing file

See fopen(3S) for additional information. 

offset identifies the byte offset where the TIFF file header occurs in the file; for TIFF files, this should be zero (0). Non-zero indicates that the TIFF file is contained within another file that is offset bytes from the beginning of that file. 

mustBeZero identifies a value that must be zero; this parameter is reserved for future use. 

RETURN VALUE

Upon successful completion, ilConnectFile() returns a pointer to an ilFile data structure; this structure is used to access a TIFF file.  NULL (0) is returned if an error occurs. For example, NULL (0) is returned if the given file is not a TIFF file. 

ERRORS

If the call fails, context->error receives a non-zero error code. 

EXAMPLE

The following example creates a null file, opens it for output, and connects the IL to it, for writing a TIFF file. 

char filename[];

ilContext context;

FILE stdioFile;

ilFile pFile;
.
.
.

stdioFile = fopen(filename, "w+");

if (stdioFile) { /∗ first create il context ∗/
if (!ilInitFile (context, stdioFile, 0, TRUE, 0))

return(context->error);

fclose (stdioFile);

stdioFile = fopen(filename, "r+");

if (!(pFile = ilConnectFile (context, stdioFile, 0, 0)))

return(context->error);

}

AUTHOR

ilConnectFile() was developed by HP. 

SEE ALSO

ilInitFile(3X), IL_CREATE_CONTEXT(3X), ilListFileImages(3X), ilReadFileImage(3X), ilWriteFileImage(3X). 

Using the Image Developer’s Kit.

Hewlett-Packard Company  —  Image Library: February, 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026