i defined a sysvar as a string in CANalyzer to use it with a panel.
Then in a CAPL a would like to get the value of this variable and save the name,i tried as i usually do in CAPL with the numbers so:
write("%s",@namespace::name_of_variable)
But i got an error saying tha the '@' should be used only for integer or float variables. How can i get the value of this string and save it in a local variable to reused it in a CAPL?
Thanks in advice.
Asked
Active
Viewed 2,731 times
3

Jordan.M
- 103
- 1
- 2
- 9
1 Answers
2
The CAPL function you are looking for is sysGetVariableString
Usage is as follows:
char value[100]; //has to be big enough to hold the value
sysGetVariableString(sysvar::namespace::name_of_variable, value, elcount(value));

MSpiller
- 3,500
- 2
- 12
- 24
-
To read a member of the struct, the `sysvarMember` shall be used instead of `sysvar`. For example: `sysvarMember::namespace::name_of_struct.name_of_member`. – radoslav006 Aug 30 '23 at 13:28