LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Scan for a variable number of items

Hello
 
I have a scan function to get data from a string with comma seperated values: Scan (p_data_in_str, "%256i[ux]", p_lcos->lut[POS]) In this string, 256 is the [rep] according to the Scanning Functions help.
Now, some things have changed and the buffer can contain 256 or 1024 items. How can I use a variable in my Scan function (say the variable num_items contains the size of the array)? The code Scan (p_data_in_str, "%num_itemsi[ux]", p_lcos->lut[POS]) obviously returns an error Smiley Wink
I could use an if statement to solve my problem, but I would prefer to keep my code compatible with future changes...
 
Thanks for all hints.
0 Kudos
Message 1 of 3
(3,014 Views)
Have you tried something along the lines:
 
    Scan (p_data_in_str, "%*i[ux]", num_items, p_lcos->lut[POS]);
 
JR
Message 2 of 3
(3,014 Views)

Thanks a lot JR.

I didn't read the possibility of using an asterix in the help file (which is quite large Smiley Wink ). You saved my day!

0 Kudos
Message 3 of 3
(3,009 Views)