Get value for variable name defined as string
Hello,
I would like to known if it possibe to obtain a value of variable defined as string. For example: char* varname[] = {"test", "dog"} test = 5; dog = 8; Can I obtain value of varname[1]??? I use C++. Best regards. |
homework eh?
at least try something. |
Quote:
I am sorry, but I dont understand what are you tried to say. Homework??? at least, ten years or more last time when I have opened a book to study. I have try some code, but it is to insert all variables in a list. Code:
#include <iostream> Then, I have look for information about it, and I dont find clear information (tcl_getvar of tcl library, but I dont know if I can use it) And now, I am here, to look for help, but I see that it is very hard to find it. And know in my language, No se por que te pones asi o por que me saltas con eso de que si son "homework". Me parece que la respuesta esta fuera de contexto y no tengo ganas de discutir con nadie. Best regards |
since its not homework, then tell us what you are trying to do? A low level system programming project?? driver programming?? game programming?? If they are not one of these, then i suggest learning and using a scripting language instead. they have easier to use data structures and much more.
|
Quote:
Well, I have develop program, Qt with Rt threads that controlled a machine. It works fine. Now I am interesting to read some variables in a webserver. My idea is use mysql server and connect webpage to mysql table where is a name of var and value. Webpage and mysql works. But now I have problem. I have a file where is the name of variables that I would like to read value a insert in mysql table, and I dont know how to eval value for variable name defined as string. Code:
sprintf(sql_consulta, "UPDATE watch set value = '%ld' WHERE name='contador1'", counter.general); More or less, this is I trying to do. Best regards. |
All times are GMT -5. The time now is 07:50 PM. |