Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Leda > Re: enum conver...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 185 of 212
Post > Topic >>

Re: enum conversion problem

by Mathias <stroke@[EMAIL PROTECTED] > Jan 23, 2005 at 05:26 PM

Dennis Schulz wrote:

> Hi, I have the following problem:
> I want to find out the number of the month from given string.
> I defined 12 constants as a enum type num:
> 
> enum num{Jan=1, Feb=2, Mar=3, Apr=4, May=5, Jun=6, Jul=7, Aug=8,
> Sep=9, Okt=10, Nov=11, Dec=12};
> 
> now I want to access the number of the month
> 
> This is working:
> num n = Dec;
> 
> There is an error:
> num n = static_cast<num>(MyString);
> 
> How can I convert it to a num type??
> 
> Thank you

Try the functions atoi, atof and so on.
Example:

 char* string = "34";
 int   num = atoi(string); // converts the string '34' to integer
-- 
You don't need a reason to help people!
 




 2 Posts in Topic:
enum conversion problem
d.schulz81@[EMAIL PROTECT  2005-01-15 16:45:30 
Re: enum conversion problem
Mathias <stroke@[EMAIL  2005-01-23 17:26:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:31:59 CDT 2008.