Some input is being skipped and it sets the variable to null or empty or something. Here is the relevant code
The first cin works but the second one is skipped and an empty string is sent to the server. Can someone help me?
short int bindedPort; //prompt for the port std::cout<<"What port would you like to bind to?"<<std::flush; std::cin >> bindedPort; std::cout << std::endl; std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' ); // Let the server know this client is connected std::string ID; std::cout<<"\nEnter an ID: "<<std::flush; ID = std::cin.get();
The first cin works but the second one is skipped and an empty string is sent to the server. Can someone help me?