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++ > Remove first tw...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 43712 of 48020
Post > Topic >>

Remove first two characters from char* or from int?

by yogi_bear_79 <yogi_bear_79@[EMAIL PROTECTED] > Mar 5, 2008 at 06:52 PM

I have a char *year that contains a 4-digit year (i.e 1929), I use the
following syntax c = atoi(year); to convert it to an integer.  However
I must strip the first two numbers.  I've tried to convert it from
char* to a string and use the erase function, which works, but then I
can't seem to convert the string it to an integer.  I am impartial as
to when I remove the first two digits, meaning it can be done before
or after the conversion to int.  In my example above the end result
should be an integer variable equalling 29.
 




 5 Posts in Topic:
Remove first two characters from char* or from int?
yogi_bear_79 <yogi_bea  2008-03-05 18:52:34 
Re: Remove first two characters from char* or from int?
Jerry Coffin <jcoffin@  2008-03-05 20:01:01 
Re: Remove first two characters from char* or from int?
yogi_bear_79 <yogi_bea  2008-03-05 19:16:48 
Re: Remove first two characters from char* or from int?
Juha Nieminen <nospam@  2008-03-06 15:52:22 
Re: Remove first two characters from char* or from int?
Jack Klein <jackklein@  2008-03-05 22:27:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Tue Oct 14 8:42:56 CDT 2008.