The majority of forums are now only available as archives, which means posting/editing is disabled.
The Anything and Everything forum is still open.
Time: 2013-05-18, 12:15pm
Please
login or
register to post a reply.
|
|
| Subject: C++ problem · Posted: 2003-10-23, 05:49am |
|
|
|
Rank: Unregistered
|
I wanted to know if it is possible to see if something is defined using a variable. For example, say you have the following code:
#define NAME "Scott"
main()
{
char pszStr[50];
strcpy(pszStr, "NAME"  ;
//At this point pszStr = "NAME"
cout << NAME; // this will output "Scott"
cout << pszStr; // this will ouput "NAME"
}
Is there some way you can see if NAME is defined using the variable pszStr? If so, is there then a way to get the value of NAME?
|
|
|
| Subject: Re: C++ problem · Posted: 2003-10-23, 08:02am |
|
|
|
Rank: ? (4827)
Member #: 3416
|
use: strcpy(pszStr, NAME);
alternately, you can find out if NAME is defined using something like this:
#ifdef NAME
my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
|
Pages: 1
Please
login or
register to post a reply.