ini_SetSectionFilter

Hello

I want to know how to use the ini_SetSectionFilter functions.

When read the help file: Ini_SetSectionFilter

int Ini_SetSectionFilter (IniText handle, Ini_SectionFilterFunc sectionFilterFunction, void * callbackData);

need for a new function to define

int CVICALLBACK FilterFunction(IniText theIniText, void *callbackData, char *sectionName);

Anyway, how to set the FilterFunction function? are there examples of code? and where I can get members of the iniText sets?

I'm trying to save some tests given in files using the functions iniText because of the data are readable and searchable. but when the data grows, I need to read a subset of data without the overhead of reading the entire file into memory.

Thank you very much in advance.

Hi again,

I can sound as if I repeat myself, but this is because there is only one way to explain this.

The sectionName parameter is passed to your callback as input.

It is filled with Ini_ReadFromFile according to the current name of the section that it is reading.

So, you first declare and implement a function like this: CVICALLBACK MyFilterFunction(IniText theIniText, void *callbackData, char *sectionName) int;

Second, to type this name (function FilterFunction) as the second parameter in Ini_SetSectionFilter (...).

So, your code will look like: Ini_SetSectionFilter (iniHandle, MyFilterFunction, NULL);

Even at this stage, your code compiles, but you must fill in the MyFilterFunction either works the way you want.

For example, when you implement the MyFilterFunction, you would write something like this:

int CVICALLBACK MyFilterFunction(IniText iniHandle, void *callbackData, char sectionName[100])
{
If (sectionName [0] == 'A') return 1;
else return 0;
}

The function example I gave above will filter (skip) all section names not starting not not by "A".

Hope this helps,

Tags: NI Software

Similar Questions

Maybe you are looking for