Thread: Coversion of "String to Integer" ?!

  1. #1

    Coversion of "String to Integer" ?!

    Anyone knows how can a string that holds a number be assigned to a variable declared of integer data type ? I've tried to use casting but it fails to work.

    eg. string temp = "26";
    int num;

    num = temp; ?! how to ?!

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    you need atoi().....

    if your quick, you will catch the example that Quzah has just posted on the C Board

    run run run........

  3. #3


    Thanx a lot buddy ! Now, my program is working smoothly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Coversion operator template specialisation
    By DL1 in forum C++ Programming
    Replies: 8
    Last Post: 01-20-2009, 03:14 AM
  2. Error: "String does not name a type", confused
    By Blizzarddog in forum C++ Programming
    Replies: 8
    Last Post: 10-21-2005, 12:57 PM
  3. Pointer to long (and vice versa) coversion warnings
    By Xzyx987X in forum C Programming
    Replies: 3
    Last Post: 06-28-2004, 01:26 AM
  4. Mac to Windows Pic Coversion error (RIFF)
    By Nakeerb in forum Windows Programming
    Replies: 2
    Last Post: 01-17-2003, 06:55 PM
  5. problem with "comparison between pointer and integer"
    By unregistered in forum C Programming
    Replies: 8
    Last Post: 05-24-2002, 11:49 PM