1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ String to Const Char

Discussion in 'C++' started by CzechRock3, Aug 29, 2010.

  1. CzechRock3

    CzechRock3 New Member

    Aug 29, 2010
    Likes Received:
    Trophy Points:
    So I am programming a binary to decimal conversion program... But the twist is, I want to Convert my input string to a const char, and from the const char I want to convert it to an integer... Because I can not just convert a string directly to a integer.

    My issue is, I want to get the length of the users input... Basically, if I input 111 the length would be 3, but later I want to input 111111 the length would be 6. I don't want the length to be predefined. From there I want to then place the seperate digits into an integer array, so that I can put it through my algorythm. Without knowing the length length of the input it becomes usless... lol.

    My problem occurs when I am trying to convert a specific character in the string to an integer for storage in the array... I don't know if its possible, and if not I would gladly appreciate an alternative method of conversion without length limits.

Share This Page