Hey guys,

Just wondering how I check for the space bar input...since my program doesn't seem to want to know when I hit the space bar..... It just outputs a space on the konsole window and then hitting enter makes a new line...

cheers John

>It just outputs a space on the konsole window and then hitting enter makes a new line...
That's correct behavior. Input in C++ is line oriented. If you want to just hit a space and have it be recognized immediately, you need to use a non-standard function such as getch to take raw input.

can u send the code or would u be more spcific about ur answer

Member Avatar for Nirvin M

char ch;
ch = getchar();
if(ch==' ')
{
-- do something with ch --
}

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.