I'll admit, I feel like an idiot. It's 3 in the morning and I refuse to go to bed until this is solved. So here's the dealio:

void doThisIGuess()
{
    int numb = getch();
    char numa = char(numb);

    int num = atoi(&numa);
    if (num != 0)
    {
        cout << num;

    }
    else cout << numa;
    return;
}

I know it's a bit roundabout, but I'm a simple guy and I don't want too much tough code all at once since this function is part of a pretty complex program. Or something. Anyhow, it should return the key you pressed (as long as it's an ASCII value, number or letter) and it does for the most part.... 'a' returns 'a', 'b' returns 'b', but for some reason, all of the numbers return doubles of themselves. For instance, '1' returns '11', '2' returns '22', etc. WTCPP?

O mighty C++ gods, how you taunt me. atoi(), I presume, doesn't get assigned to a variable like char() does -- that is, i = int(j) works, but i = atoi(&j) just modifies j. Well, I guess that's that. If anyone else is having that problem, here's your solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.