delorie.com/archives/browse.cgi | search |
Message-ID: | <003a01c10293$4540b080$267a5a8f@neo> |
From: | "Rogerio Mazakina" <dway AT designer DOT mailbr DOT com DOT br> |
To: | <djgpp AT delorie DOT com> |
References: | <9hlpjj$7v8$1 AT wildfire DOT prairienet DOT org> <993950358 DOT 624207 AT queeg DOT ludd DOT luth DOT se> |
Subject: | Variable names to string |
Date: | Sun, 1 Jul 2001 22:06:47 -0300 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 5.50.4133.2400 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
Reply-To: | djgpp AT delorie DOT com |
I can get the variable name and convert to string but i need to get the variable value by the name of the variable(string) Ex: #define VAR_STR(var,str) str = #var; string VarName; int foo; VAR_STR(foo, VarName) cout << VarName << endl; // will print "foo"; I need the reverse. #define STR_VAR(str,var) var = valueOf(str); int bar; STR_VAR(VarName,bar) cout << bar << endl; // will print the value of foo someone can help me?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |