public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is there a method in String class to convert a string to an int?
@ 2004-09-14  7:31 learning c++
  2004-09-14  8:23 ` m.
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: learning c++ @ 2004-09-14  7:31 UTC (permalink / raw)
  To: gcc-help

Hi,
Is there a method in String class to convert a string to an int?
In C, there is atoi function. How about in C++?

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a method in String class to convert a string to an int?
  2004-09-14  7:31 Is there a method in String class to convert a string to an int? learning c++
@ 2004-09-14  8:23 ` m.
  2004-09-14  9:25 ` Claudio Bley
  2004-09-14 11:39 ` Eljay Love-Jensen
  2 siblings, 0 replies; 4+ messages in thread
From: m. @ 2004-09-14  8:23 UTC (permalink / raw)
  To: gcc-help

Use std::istringstream for this.
m.

learning c++ wrote:
> Hi,
> Is there a method in String class to convert a string to an int?
> In C, there is atoi function. How about in C++?
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join.msn.com/?page=features/featuredemail
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a method in String class to convert a string to an int?
  2004-09-14  7:31 Is there a method in String class to convert a string to an int? learning c++
  2004-09-14  8:23 ` m.
@ 2004-09-14  9:25 ` Claudio Bley
  2004-09-14 11:39 ` Eljay Love-Jensen
  2 siblings, 0 replies; 4+ messages in thread
From: Claudio Bley @ 2004-09-14  9:25 UTC (permalink / raw)
  To: gcc-help

On Tue, Sep 14, 2004 at 10:23:45AM +0300, learning c++ wrote:
> Hi,
> Is there a method in String class to convert a string to an int?
> In C, there is atoi function. How about in C++?

Hi.

As much fun as this is (or better: was), this is not the 
"learning c++ for dummies" mailing list or forum. 

Your questions are off topic here since this mailing list
deals specifically with issues regarding GCC - the Gnu 
Compiler Collection. If I'm not seriously mistaken, your
postings never included the word gcc or g++ which is usually
quite a strong indication that you posting to the wrong list.

And WHY don't you get a good book on C++? This can't be so hard.
I mean, if you don't want to buy, maybe you can borrow it from
someone. 

And then, take the time and read it. If you don't understand
something, just read it again. Usually it gets clearer on the
second or third read. 

If you still have problems understanding something you surely
should seek help from more experienced people. A good forum
for your questions on usenet would be e.g.:

comp.lang.c++  OR
comp.lang.c++.moderated

There are also a lot other resources, web based forums and 
references out there. E.g.:

http://www.icce.rug.nl/documents/cplusplus/
http://www.cprogramming.com/

Also, since you're using GCC (at least I assume that) it is all 
open code and you can have a look at the string class whether
it has a function returning an integer representation of its
value or not. Also there are a few C++ STL online references 
out there you could have read. Just search the web.

(e.g. http://www.dinkumware.com/refxcpp.html)


Kind regards,
Claudio 

PS: Sorry for ranting, but I had to get this off my chest...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is there a method in String class to convert a string to  an int?
  2004-09-14  7:31 Is there a method in String class to convert a string to an int? learning c++
  2004-09-14  8:23 ` m.
  2004-09-14  9:25 ` Claudio Bley
@ 2004-09-14 11:39 ` Eljay Love-Jensen
  2 siblings, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-09-14 11:39 UTC (permalink / raw)
  To: learning c++, gcc-help

Hi,

Use std::istringstream or BOOST lexical_cast.

http://www.boost.org/libs/conversion/lexical_cast.htm

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-14 11:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-14  7:31 Is there a method in String class to convert a string to an int? learning c++
2004-09-14  8:23 ` m.
2004-09-14  9:25 ` Claudio Bley
2004-09-14 11:39 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).