# nfxSplitFile

Splits a single TIFF-F or TIFF-S file into a specified number of TIFF-F or TIFF-S files.

#### Prototype

DWORD nfxSplitFile ( CTAHD ctahd, char input_file_name, DWORD number_output_files, char *output_files[], DWORD *number_of_pages)

Argument | Description
ctahd | Context handle returned by ctaCreateContext.
input_file_name | Name of input file.
number_output_files | Number of output file names passed to function.
output_files | Pointer to an array of output file names.
number_of_pages | Pointer to the number of pages processed.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | A function argument is invalid.
CTAERR_FILE_OPEN_FAILURE | Error opening file.
CTAERR_FILE_NOT_FOUND | The specified input file does not exist.
CTAERR_FILE_READ_FAILURE | Error reading file.
CTAERR_FILE_WRITE_FAILURE | Error writing to file.
CTAERR_INVALID_CTAHD | The specified context handle is invalid.
NFXERR_BAD_FILE_FORMAT | The specified input file is not in a format valid for conversion.

#### Events

None.

#### Details

nfxSplitFile examines the TIFF-F or TIFF-S input file and creates multiple TIFF-F or TIFF-S output files. The pages of the input file are considered a string of pages. The files named in the output_files array are written - one page to a file - until the last file is reached. All remaining pages are copied into the last file. If you specify only two output files, nfxSplitFile is a convenient way to remove cover pages from a received TIFF-F or TIFF-S file.

Although TIFF-F files can contain pages with different attributes, nfxSplitFile does not convert or examine attributes. It simply copies whole pages from a single input TIFF-F file to multiple TIFF-F output files.

Use nfxCheckTIFF to examine the attributes of all input files before operating on them with either nfxMergeFile or nfxSplitFile.

Compare number_output_files with number_of_pages for a quick indication of the number of output files created, and the number of pages in each output file. The number of files actually created is the smaller of number_of_pages and number_output_files. Extra output files are not used. There must be at least one output file.

nfxSplitFile does not modify the contents of the input file.

Note: You must continue processing events during an active fax session. Make sure that file I/O intensive operations, such as splitting files, do not interfere with the handling of events and cause the fax session to time out. The application should process events within three seconds.

Refer to Performing offline image conversion for more information.

#### See also

nfxCheckTIFF, nfxMergeFile