LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Max number of elements in Scan function

Hi all, I am getting some errors in using Scan () function to read a huge string. I receive a non-fatal error (Number of arguments exceed the maximum supported) when the number of arguments reaches 30 elements. There is no such specification in the online help (which infact recitates on Target(s) field "Specifies the variables in which the scanned items will be stored. There may be up to 14 arguments. These arguments must be separated by commas. Only the value of the first argument is shown at the bottom of the control after the function panel is executed." Highlighted limit seems to apply to the function panel rather than to the function itself).
 
I have found this error while developing an app in CVI 7.1 but testing it in CVI8.5 gives the same result: is it an actual limit or should I go searching for some error in code?


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 1 of 3
(3,365 Views)

Hi Roberto,

I've been able to reproduce the issue you're encountering in this way:

gets(stringa);
 
 Scan(stringa,"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%cc",&target1,&target2,&target3,&target4,&target5,&target6,&target7,&target8,&target9,&target10,&target11,&target12,&target13,&target14,&target15,&target16,&target17,&target18,&target19,&target20,&target21,&target22,&target23,&target24,&target25,&target26,&target27,&target28,&target29);
 

In this way everything works fine, if I add another argument I get the Fatal Error that you're encountering.

So I guess the upper limit of the argument functions is not 14 but 29.

Regards,

Andrea N. 

Andrea N.
Principal Applications Engineer - Semiconductor EMEA
National Instruments Italy
Certified LabVIEW Architect - Certified TestStand Architect
0 Kudos
Message 2 of 3
(3,322 Views)

OK, for the moment I have solved in an alternative way; using your example:

Scan(stringa,"%c%c%c%c%c%c%c%c%c%c",
    &target1, &target2, &target3, &target4, &target5, &target6, &target7, &target8, &target9, &target10);
ftmb = NumFmtdBytes ();
Scan (string + fmtb, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
    &target11, &target12, &target13, &target14, &target15, &target16, &target17, &target18, &target19, &target20,
    &target21, &target22, &target23, &target24, &target25, &target26, &target27, &target28, &target29, &target30);

It would be better to update Scan documentation adding a warning about this limit, if this is not likely to change in the future.



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 3 of 3
(3,307 Views)