Ini_ReadGeneric

int Ini_ReadGeneric (IniText handle, Ini_InputFunc inputFunction, void *inputSource);

Purpose

Reads the tag/value pairs into the list identified by handle from the specified inputSource by calling the specified inputFunction.

This function allows you to read into memory data from any source, such as a memory mapped file or a TCP/IP address.

If you want to read from a disk file, you can use the function Ini_ReadFromFile.

Parameters

Input
Name Type Description
handle IniText A handle returned from Ini_New. It represents the list of in-memory tag/value pairs.
inputFunction Ini_InputFunc A pointer to a callback function that is called to read in each line of the IniText.

The prototype for the callback function is:

int CVICALLBACK InputFunc(void *inputSource, char *inputBuffer, int maxLineLength, int *endOfSource, int *lineNumRead);


The callback function should return 0 if it successfully reads a line of text. Otherwise, it should return a negative error code, which is then returned by Ini_ReadGeneric.

The callback function should copy the line that it reads into the inputBuffer parameter as a NULL terminated string. The maxLineLength parameter specifies the maximum number of characters (not including the NULL byte) that can be safely copied into the inputBuffer. If your inputFunction encounters a line longer than this limit, it can return a negative error code or it can discard the extra characters. The default maximum line length is 255, which is specified as a macro in inifile.c.

The callback function should set the *endOfSource parameter to a non-zero value if there may be further lines to read.

The callback function should set the *lineNumRead parameter to the 1–based index of the line that was read. If this information is not needed, *lineNumRead can be set to zero.
inputSource void * A value representing the input source. This value is passed to the specified input function.
Note   This value can be used to pass a pointer to a structure which contains the information necessary for the input function to read from a particular source, such as a memory mapped file or a TCP/IP address.

Return Value

Name Type Description
status integer Indicates whether the function was successful.

A zero indicates success.

A negative value indicates an error. If the value is from –1 to –999, it is one of the error values defined in userint.h. If the value is from –5000 to –5999, it is one of the error values defined in toolbox.h.

If the specified input function returns a negative value, the value is returned by Ini_ReadGeneric.

Among the more commonly encountered errors are:
–12 Out of memory!
–91 Too many files are open.
–92 Unexpectedly reached end of file.
–93 Input/Output error.
–94 File not found.
–95 File access permission denied.
–99 File already open.
–100 Badly formed pathname.
–5001 Could not open file for reading
–5002 Error reading file