I was wondering if there was a method to parse out the value_t union.
My main goal currently is to print out the result of setting a RIG_LEVEL setting_t).
For instance: "snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value);"
Here setting_value is the setting_t while value is the value_t.
Thank you!
William Gardner
K15SZM
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A value is either int or float.
if (RIG_LEVEL_IS_FLOAT(setting_value))snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value.f)
elsesnprintf(output, 100, "%s set to %d", rig_strlevel(setting_value), value.i)
Or could do this:float mylevel = RIG_LEVEL_IS_FLOAT(setting_value) ? value.f : value.i;snprintf(output, 100, "%s set to %g", rig_strlevel(setting_value), value.i)
I was wondering if there was a method to parse out the value_t union.
My main goal currently is to print out the result of setting a RIG_LEVEL setting_t).
For instance: "snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value);"
Here setting_value is the setting_t while value is the value_t.
This helps so much! I saw that it could also be a char* in the documentation manual and didn't know if there was some RIG_LEVEL feature that used that type. Now knowing it can only be an int or float makes it easier. Either way, thank you! I will implement that right now.
William Gardner
K15SZM
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was wondering if there was a method to parse out the value_t union.
My main goal currently is to print out the result of setting a RIG_LEVEL setting_t).
For instance: "snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value);"
Here setting_value is the setting_t while value is the value_t.
Thank you!
William Gardner
K15SZM
A value is either int or float.
if (RIG_LEVEL_IS_FLOAT(setting_value))snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value.f)
elsesnprintf(output, 100, "%s set to %d", rig_strlevel(setting_value), value.i)
Or could do this:float mylevel = RIG_LEVEL_IS_FLOAT(setting_value) ? value.f : value.i;snprintf(output, 100, "%s set to %g", rig_strlevel(setting_value), value.i)
Mike W9MDB
I was wondering if there was a method to parse out the value_t union.
My main goal currently is to print out the result of setting a RIG_LEVEL setting_t).
For instance: "snprintf(output, 100, "%s set to %f", rig_strlevel(setting_value), value);"
Here setting_value is the setting_t while value is the value_t.
Thank you!
William Gardner
K15SZM
Printing the value_t Union
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/hamlib/discussion/25919/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
This helps so much! I saw that it could also be a char* in the documentation manual and didn't know if there was some RIG_LEVEL feature that used that type. Now knowing it can only be an int or float makes it easier. Either way, thank you! I will implement that right now.
William Gardner
K15SZM