Thread: Strings into Ints

  1. #1

    Exclamation Strings into Ints


    I have a quick question.

    I need to change some strings into ints.
    For example:

    string a = "5";
    int b = (int version of a);

    (b = 5);

    I think there's a function somewhere that helps me do that, but I don't remember the name of it.

    Does anyone remember it?
    If there isn't such a function, is there a way for me to do this?

    Thanks a lot!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    int b = atoi ( a.c_str() );

    My best code is written with the delete key.

  3. #3
    that's it!

    Thanks a lot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to handle ints and strings when writing to file
    By agentsmith in forum C Programming
    Replies: 11
    Last Post: 04-23-2008, 04:44 AM
  2. Array of Ints to a Strings
    By mattAU in forum C Programming
    Replies: 10
    Last Post: 08-17-2006, 05:25 AM
  3. writing strings chars from ints
    By deleeuw in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2003, 09:09 AM
  4. converting strings to ints
    By HomerJ in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2002, 06:08 PM
  5. Converting strings to ints
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 04-25-2002, 02:48 PM