473,464 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

iDENTIFIER CONVERSION INTO STRING

I want to know that how we can get identifier of a variable as string at run time.
this will seem something like this:

int empno=20;
char *id=identifier_to_string(emp);
cout<<id; =>it should print emp;

or

int empno=20;
char *id="emp";
cout<<string_as_identifier(id); => it should print 20;

I will be gratefull to you for help.
Feb 19 '07 #1
2 1195
willakawill
1,646 1GB
Hi. Perhaps it would be more useful if you were to explain what it is that you want to achieve without referring to strings etc. What you want this part of your app to do. because cout << empno; will also output 20.
Thanks
Feb 19 '07 #2
AdrianH
1,251 Expert 1GB
What will has said is true, you can store the info as integers.

C++ doesn't intrinsically store the strings of enums. Though there have been times I wish it did. I have done things to work around it, but I can tell you it ain’t pretty. :) It requires the use of the pre-processor directives. If you really want this, I can post it, but be advised, what I am talking about is very advanced and if you were to use it in a course without being able to explain what the hell you are doing, you will get an automatic zero.

That said, it is pretty neat stuff. ;)


Adrian
Feb 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Florian Preknya | last post by:
I work on building a metamodel from an UML diagram (serialized as xmi). There I have a class called Class that represents a class from the UML model. The Class has a name member and ininitially it...
10
by: teddarr | last post by:
I am trying to construct a class with several functions and identifiers. The identifier in question is static double AIR which will hold the value of the annual interest rate in the class. I have...
0
by: Jeff | last post by:
I have been using a view state decoder utility to understand the contents of ViewState. In looking at the decoded contents of many aspx pages (from my own projects and from asp.net sites out on...
2
by: dbonin1599 | last post by:
I have the following code, the first set of code is the SQL version, the second set of code is an attempt to put the code into a VB String see "UpdateVariations". I need help, I think most of it is...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.