How to limit amount of character in console windows

Hello,

I am C++ beginner and I am creating a C++ Windows console application using Visual Studio 2008, this application has fields to input data, I created a function which works fine, but I would like to create something that limits the users input, such as date field, once the user type the month which will use only two numbers and does not allow type anything else.

Below is the function I am using.



void getInfo()
{

char GetVal[3] = {' '};
cin.getline(GetVal,3);
pInfo = GetVal;
}

Thanks a lot

MM.
I suggest you using (pd)curses, that library allows you to do (almost) whatever you want with the console input/output
Topic archived. No new replies allowed.