I am trying to read just one character but my loop continues to grab the key entered and the 'enter' key. How do I keep that from happening and only grab the first key? Here is an example:
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int rseed = 1448736593;
int main(int argc, char** argv) {
    printf("#Program started successfully with random seed %i\n", rseed);
    int c;
    while(true) {
        printf("input: ");
        c = getchar();
        printf("You selected %i\n", c); 
    }   
    return 0;
}
and here is what the code gives:
#Program started successfully with random seed 1448736593
input: 2
You selected 50
input: You selected 10
input: 3
You selected 51
input: You selected 10
input: 1
You selected 49
input: You selected 10
input: ^C
How do I keep it from also telling me that I selected 10? I want to reserve that for when the user just hits 'enter' and nothing else.
 
     
     
    