W
Walter Roberson
Olivier said:Is there a way to specify a identifier from a string?
String would be "aux1", identifier would be aux1?
I fear that no, but ...
As you feared, the answer is NO.
You would not want to do this without constraints anyhow, as
the user could deliberately choose one of your variables
that are important for controlling the program, or could choose
one of the variables of the implementation. You would effectively
need to check the string against all the variable names that
you want to be allowed -- and if you are going through that trouble
it is little more work to actually code the variable instead of
hoping to be able to "interpret" it.
if (strcmp(varname,"aux1") == 0) readout = aux1
else if (strcmp(varname,"beta2") == 0) readout = beta2
and so on