Import_OpenFile()

Examples


The Import_OpenFile() function opens a specified text file and reserves a file ID. This file ID must be used with the remainder of the functions in the Import library.

Syntax

Import_OpenFile(product_ID, pathname, delimiter_type, num_fields)

Parameters

product_ID – An integer indicating the dictionary’s ID.

pathname A string specifying the full generic path and file name for the text file.

delimiter_type An integer indicating the delimiter (tab or comma) used by the text file. Use one of the following constants:

[spacer]

Constant

Description

COMMAFILE

Comma delimiter

TABFILE

Tab delimiter


num_fields An integer returned by this function representing the number of fields. This is the number of text items separated by the delimiter character (comma or tab) in the first record (line). If the file can’t be opened, this function returns num_fields as zero (0).

Return value

An integer representing a unique file ID. This file ID must be used in the remainder of the functions in the Import library. If this value is 0, an open error occurred.

Comments

Each record in the import file is limited to 2047 total characters (including the CR/LF combination at the end of the record). If the imported line exceeds this length, the remainder of the line will be truncated.

Always close a text file using Import_CloseFile() once you’ve opened it using Import_OpenFile().


Documentation Feedback