LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Search variable + character in a structure

I have written information from a file into a structure and a table (with strtok). These are couples keyword - value.
Among the values are parameters. These look like this: $ PnB
Each file has a different number of parameters (n = number of parameters). But I have a problem seaching for a combination of letters and numbers.
Because the number is dynamic, must be "n" a variable!
Another problem is that any extensive search through these records much too long. I'm perplexed. I have no idea how to proceed. I have tried different approaches and had no success (during the reading process with if while and read pointers ...).

It would be best if I could build me a Sting with a variable, but I do not know that going into C.

0 Kudos
Message 1 of 4
(3,287 Views)

The table you are referring to is a native CVI table control? if so, you could use GetTableCellFromValue command to search directly inside the control. Look in the online help for the function for an explanation of the parameters usage.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,263 Views)

I am not sure if i understand your description correctly, but it take it that you are going to do a more or less complicated string search. Is that correct?

You can build dynamic strings anytime. In CVI, you can either use the ANSI C commands like strcat and similar or you can use the CVI format command "Fmt".

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 4
(3,251 Views)

Norbert Yes, I can build a number into a string with your solution, but ultimately it is again a string. How do I have to constantly build together for each parameter.
But I think I found a better solution for me.
I show with pointers to the place where I expect the number and check with isdiggit whether it is really a number. With atoi I will make them available to me as a int number. I think it is easiest.

With this option, I get the important information quickly and can continue to use the same number. In a loop over and over again.

0 Kudos
Message 4 of 4
(3,206 Views)