OutputList
size_t OutputList (ListType list, FILE *stream, const char listPrefix[], const char listSuffix[], const char itemPrefix[], const char itemSuffix[], ItemOutputFunction itemOutputFunction);
Purpose
This function is useful for writing the contents of a list to the standard I/O window, or to a file. The list and item prefix and suffix parameters control the format of the output.
Parameters
Input | ||
Name | Type | Description |
list | ListType | The list whose contents are to be output to the specified stream. |
stream | FILE * | This parameter specifies which FILE* stream to output the item to. If you specify stdout, then the contents of the list are sent to the standard output device, which is usually the console window. |
listPrefix | const char[] | Specifies a string that will be output before the list is output. This parameter is useful for preceding the contents of a list with a title or heading. Pass 0 to specify that no list prefix should be output. |
listSuffix | const char[] | Specifies a string that will be output after the contents of the list are output. This parameter is useful for following a list with summary information and to specify whether the last list item is followed by a newline or not. If the string contains a "%d", it will be replaced with the index number of the last item that was output. |
itemPrefix | const char[] | Specifies a string that will be output before the contents of each list item is output. If the string contains a "%d", it will be replaced with the index number of the item being output. This parameter is useful for preceding list items with their index numbers. Pass 0 to specify that no item prefix should be output. |
itemSuffix | const char[] | Specifies a string that will be output after the contents of each list item is output. If the string contains a "%d", it will be replaced with the index number of the item being output. The item suffix will not be output after the last item in a list. This parameter is useful for separating list items with commas, spaces and/or newlines. Pass 0 to specify that no item suffix should be output. |
itemOutputFunction | ItemOutputFunction | This parameter specifies the function that OutputList will call to output each list item. The function must have the following prototype. int CVICALLBACK ItemOutputFunction(FILE *stream, void *ptrToItem); The function should return how many characters were written or return a negative value if an error occurs. This parameter can either be a user defined function written to output a user defined item type, or it can be one of the predefined item output functions: OutputStringItem; /* for lists of pointers to strings */ OutputShortItem; /* for lists of short integers */ OutputIntegerItem; /* for lists of integers */ OutputDoubleItem; /* for lists doubles */ |
Return Value
Name | Type | Description |
numCharactersOutput | size_t | Returns the number of characters output, or a negative error code. |
Additional Information
Library: Programmer's Toolbox
Include file: toolbox\toolbox.h
LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later